How to find an oid that's not uesd now?
I'm adding a new index in pg, but I find this. Duplicate OIDs detected: Duplicate OIDs detected: 357 357 found 1 duplicate OID(s) in catalog data found 1 duplicate OID(s) in catalog data what sql should I run to find one?
How to get the selectStatement parse tree info?
I'm reading this book https://www.interdb.jp/pg/pgsql03.html? I'm debugging pg, but I can't get the parse tree like this: https://files.slack.com/files-pri/T0FS7GCKS-F047H5R2UKH/1.png, can you give me some ways to get that? I'm using vscode to debug, the watch info doesn't interest me, it gives me nothing,https://files.slack.com/files-pri/T0FS7GCKS-F048MD5BTME/quzk_6bk0sug60__f_0wh2l.png jack...@gmail.com
please give me select sqls examples to distinct these!
typedef enum SetOperation { SETOP_NONE = 0, SETOP_UNION, SETOP_INTERSECT, SETOP_EXCEPT } SetOperation; jack...@gmail.com
Re: Re: please give me select sqls examples to distinct these!
> On Oct 25, 2022, at 7:55 AM, jack...@gmail.com wrote: > > > > typedef enum SetOperation > { > SETOP_NONE = 0, > SETOP_UNION, > SETOP_INTERSECT, > SETOP_EXCEPT > } SetOperation; > jack...@gmail.com Please use just text. What ‘dialect’ are using? In Postgres 0: select * from table 1: select * from table union select * from table is same shape 2: select * from table join table b on Id = idb 3: select * from table except select * from tableb
can you give me a sql example to explain this?
/* * In a "leaf" node representing a VALUES list, the above fields are all * null, and instead this field is set. Note that the elements of the * sublists are just expressions, without ResTarget decoration. Also note * that a list element can be DEFAULT (represented as a SetToDefault * node), regardless of the context of the VALUES list. It's up to parse * analysis to reject that where not valid. */ List*valuesLists; /* untransformed list of expression lists */ I need to understand what this is used for? jack...@gmail.com
access method xxx does not exist
I'm trying to add a new index, but when I finish it, I use “ create index xxx_index on t1 using xxx(a); ”,it gives me access method "my_index" does not exist And I don't know where this message is from, can you grve me its position? I do like this. I add oid in pg_am.dat and pg_proc.dat for my index. And I add codes in contrib and backend/access/myindex_name, is there any other places I need to add some infos? Who can help me? jack...@gmail.com
回复: access method xxx does not exist
I'm trying to add a new index, but when I finish it, I use “ create index xxx_index on t1 using xxx(a); ”,it gives me access method "my_index" does not exist And I don't know where this message is from, can you grve me its position? I do like this. I add oid in pg_am.dat and pg_proc.dat for my index. And I add codes in contrib and backend/access/myindex_name, is there any other places I need to add some infos? Who can help me? jack...@gmail.com
Re: Re: access method xxx does not exist
On 2022-10-29 19:19:28 +0800, jack...@gmail.com wrote: > I'm trying to add a new index, but when I finish it, I use “ create index > xxx_index on t1 using xxx(a); ”,it gives me access method "my_index" does not > exist > And I don't know where this message is from, can you grve me its position? See https://www.postgresql.org/docs/current/sql-createindex.html The syntax for CREATE INDEX is CREATE INDEX ON table_name [ USING method ] ( column_name ... ) You use USING to specify the method (e.g. btree or gin), not the table and/or columns. The columns (or expressions come in parentheses after that. So if you wanted an index on column a of table t1 you would simply write: CREATE INDEX ON t1 (a); Or if you have a function xxx and you want a function based index on xxx(a) of that table: CREATE INDEX ON t1 (xxx(a)); (You can specify the name of the index, but why would you?) > I do like this. I add oid in pg_am.dat and pg_proc.dat for my index. > And I add codes in contrib and backend/access/myindex_name, is there > any other places I need to add some infos? What? Why are you doing these things? hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
Re: Re: access method xxx does not exist
Hi, On Sat, Oct 29, 2022 at 08:15:54PM +0800, jack...@gmail.com wrote: > On 2022-10-29 19:19:28 +0800, jack...@gmail.com wrote: > > I'm trying to add a new index, but when I finish it, I use “ create index > > xxx_index on t1 using xxx(a); ”,it gives me access method "my_index" does > > not > > exist You should look at the bloom contrib in postgres source tree for an example of how to write a custom index AM.
Does it equal to execute "CREATE ACCESS METHOD"?
Sorry, I open another mail list to ask this question. When I add "{ oid => '6015', oid_symbol => 'SPB_AM_OID', descr => 'SPB index access method', amname => 'spb', amhandler => 'spbhandler', amtype => 'i' }," in pg_am.dat and add "{ oid => '388', descr => 'spb index access method handler', proname => 'spbhandler', provolatile => 'v', prorettype => 'index_am_handler', proargtypes => 'internal', prosrc => 'spbhandler' }," in pg_proc.dat, so when I use the make install && cd contrib;make install; whether it equals to execute create access method? by the way, I've added the spb codes in src/access/spb, so don't worry about the spbhandler. And Sorry for the another mail "access method xxx does not exist", you suggest me add new Am Index in contrib, But I need to modify gist to spb, so that's not my require. And I need to know add those in pg_proc.dat and pg_am.dat, if it won't create access method for spb, what else I need to do? -- jack...@gmail.com
Re: Does it equal to execute "CREATE ACCESS METHOD"?
Sorry, I open another mail list to ask this question. When I add "{ oid => '6015', oid_symbol => 'SPB_AM_OID', descr => 'SPB index access method', amname => 'spb', amhandler => 'spbhandler', amtype => 'i' }," in pg_am.dat and add "{ oid => '388', descr => 'spb index access method handler', proname => 'spbhandler', provolatile => 'v', prorettype => 'index_am_handler', proargtypes => 'internal', prosrc => 'spbhandler' }," in pg_proc.dat, so when I use the make install && cd contrib;make install; whether it equals to execute create access method? by the way, I've added the spb codes in src/access/spb, so don't worry about the spbhandler. And Sorry for the another mail "access method xxx does not exist", you suggest me add new Am Index in contrib, But I need to modify gist to spb, so that's not my require. And I need to know add those in pg_proc.dat and pg_am.dat, if it won't create access method for spb, what else I need to do? -- jack...@gmail.com
Re: Re: Does it equal to execute "CREATE ACCESS METHOD"?
"jack...@gmail.com" writes: > When I add > "{ oid => '6015', oid_symbol => 'SPB_AM_OID', > descr => 'SPB index access method', > amname => 'spb', amhandler => 'spbhandler', amtype => 'i' }," > in pg_am.dat > and add > "{ oid => '388', descr => 'spb index access method handler', > proname => 'spbhandler', provolatile => 'v', > prorettype => 'index_am_handler', proargtypes => 'internal', > prosrc => 'spbhandler' }," in pg_proc.dat, > so when I use the make install && cd contrib;make install; > whether it equals to execute create access method? Did you run initdb afterwards? What you describe here should result in an updated postgres.bki file, but that isn't the same as catalog entries in a live database. > And Sorry for the another mail "access method xxx does not exist", you > suggest me add new > Am Index in contrib, But I need to modify gist to spb, so that's not my > require. And I need to know > add those in pg_proc.dat and pg_am.dat, if it won't create access method for > spb, what else I need to > do? To be very blunt, it doesn't sound to me that your skills with Postgres are anywhere near up to the task of writing a new index access method. You should start with some less-ambitious project to gain some familiarity with the code base. regards, tom lane
Re: Re: Does it equal to execute "CREATE ACCESS METHOD"?
thanks for your advice, I realize my problems, can you give me some materials like some study routine for pg-internal? -- jack...@gmail.com >"jack...@gmail.com" writes: >> When I add >> "{ oid => '6015', oid_symbol => 'SPB_AM_OID', >> descr => 'SPB index access method', >> amname => 'spb', amhandler => 'spbhandler', amtype => 'i' }," >> in pg_am.dat >> and add >> "{ oid => '388', descr => 'spb index access method handler', >> proname => 'spbhandler', provolatile => 'v', >> prorettype => 'index_am_handler', proargtypes => 'internal', >> prosrc => 'spbhandler' }," in pg_proc.dat, >> so when I use the make install && cd contrib;make install; >> whether it equals to execute create access method? > >Did you run initdb afterwards? What you describe here should >result in an updated postgres.bki file, but that isn't the >same as catalog entries in a live database. > >> And Sorry for the another mail "access method xxx does not exist", you >> suggest me add new >> Am Index in contrib, But I need to modify gist to spb, so that's not my >> require. And I need to know >> add those in pg_proc.dat and pg_am.dat, if it won't create access method for >> spb, what else I need to >> do? > >To be very blunt, it doesn't sound to me that your skills with >Postgres are anywhere near up to the task of writing a new >index access method. You should start with some less-ambitious >project to gain some familiarity with the code base. > > regards, tom lane
there is no an example in reloptions.c for string?
jack...@gmail.com -- here is the codes for pg16. static relopt_string stringRelOpts[] = { /* list terminator */ {{NULL}} }; And I add my string type arguments here, it can't work well. When I debug, it comes to func allocateReloptStruct, at the code line "size += optstr->fill_cb(val, NULL);", it gives me segment fault. what else do I need to add? can you give me an example?
modify planner codes, get failed
jack...@gmail.com -- Hello, I'm trying to modify pg codes for my personal project. And after I finish modify planner, I get this. postgres=# create table tt(a int); CREATE TABLE postgres=# \d tt ERROR: btree index keys must be ordered by attribute the patches are below 0001-finish-planner-modify.patch Description: Binary data 0003-fix-limit-and-count-bugs.patch Description: Binary data
How to repair my plan modify error?
jacktby(at)gmail(dot)com -- Hello, I'm trying to modify pg codes for my personal project. And after I finish modify planner, I get this. postgres=# create table tt(a int); CREATE TABLE postgres=# \d tt ERROR: btree index keys must be ordered by attribute here are the patches of my modifies. 0001-finish-planner-modify.patch Description: Binary data 0003-fix-limit-and-count-bugs.patch Description: Binary data
what kind of hash algorithm is used by hash_bytes()?
jack...@gmail.com -- I can't understand the hash_bytes() func in src/backend/access/hash/hashfunc.c, it's published by a paper or others? Can you give me some materials to study it in depth?
How could I elog the tupleTableSlot to the fronted terminal?
For example, I use "insert into t values(1)"; and I 'll get a tupleTableSlot, And Now I want to get the real data , that's 1, and then use elog() func to print it. Could you give me some codes to realize that? futhermore, what If the data type is text or other types? What do I need to change? ------ jack...@gmail.com
Re: Re: How could I elog the tupleTableSlot to the fronted terminal?
>On 2023-Jan-30, jack...@gmail.com wrote: > >> For example, I use "insert into t values(1)"; and I 'll get a tupleTableSlot, >> >> And Now I want to get the real data , that's 1, and then use elog() func >> to print it. Could you give me some codes to realize that? futhermore, >> what If the data type is text or other types? What do I need to change? > >Maybe have a look at the 'debugtup()' function. It doesn't do exactly >what you want, but it may inspire you to write the code you need. > >-- >Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ >"All rings of power are equal, >But some rings of power are more equal than others." > (George Orwell's The Lord of the Rings) I use the debugtup to print, and I find out there are "printf", it doesn't print anything to the terminal. I need to know how to use this debugtup func. I think I use it as a mistake -- jack...@gmail.com
How to create a new operator inpg for spec data type?
I need to create a new operator like '<->' and its syntax is that text1 <-> text2, for the usage like this: 'a' <-> 'b' = 'a1b1', so how could I realize this one? Can you give me some exmaples. -- jack...@gmail.com
How to write a new tuple into page?
Hi, I'm trying to construct a new tuple type, that's not heaptuple, When I get a tupleTableSlot, I will get data info from it and the I will constuct a new tuple, and now I need to put it into a physical page, how should I do? -- jack...@gmail.com
Give me details of some attributes!!
here are the source codes from src/include/access/htup_details.h. /* * information stored in t_infomask: */ #define HEAP_HASNULL 0x0001 /* has null attribute(s) */ #define HEAP_HASVARWIDTH 0x0002 /* has variable-width attribute(s) */ #define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */ #define HEAP_HASOID_OLD 0x0008 /* has an object-id field */ #define HEAP_XMAX_KEYSHR_LOCK 0x0010 /* xmax is a key-shared locker */ #define HEAP_COMBOCID 0x0020 /* t_cid is a combo CID */ #define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */ #define HEAP_XMAX_LOCK_ONLY 0x0080 /* xmax, if valid, is only a locker */ And I can't understand these attrs: 1. external stored attribute(s), what is this? can you give a create statement to show me? 2. xmax is a key-shared locker/exclusive locker/only a locker, so how you use this? can you give me a scenario? let me try to explain it: if there is a txn is trying to read this heaptuple, the HEAP_XMAX_KEYSHR_LOCK bit will be set to 1. if there is a txn is trying to delete/update this heaptuple, the HEAP_XMAX_EXCL_LOCK bit will be set to 1. but for HEAP_XMAX_LOCK_ONLY, I can't understand. And another thought is that these three bit can have only one to be set 1 at most. 3. t_cid is a combo CID? what's a CID? give me an example please. -- jack...@gmail.com
what's hsitoric MVCC Snapshot?
Here are the comments in src/include/utils/snapshot.h. /* * For normal MVCC snapshot this contains the all xact IDs that are in * progress, unless the snapshot was taken during recovery in which case * it's empty. For historic MVCC snapshots, the meaning is inverted, i.e. * it contains *committed* transactions between xmin and xmax. * * note: all ids in xip[] satisfy xmin <= xip[i] < xmax */ TransactionId *xip; I can't understand the historic MVCC snapshots? can you give me a scenario to describe this? jack...@gmail.com
How does pg index page optimize dead tuples?
As far as I know, when a index page is full, if you insert a new tuple here, you will split it into two pages. But pg won't delete the half tuples in the old page in real. So if there is another tuple inserted into this old page, will pg split it again? I think that's not true, so how it solve this one? please give me a code example,thanks. jack...@gmail.com