Re: [HACKERS] Tuple data

2000-12-18 Thread Tom Lane
Hiroshi Inoue [EMAIL PROTECTED] writes: To make it usable for inherited tables requires truly horrendous kluges (as you well know). Logical/physical attribute numbers solves it naturally. Maybe. At this point that's a theory without experimental evidence to back it up ;-). I'm still

Re: [HACKERS] Tuple data

2000-12-18 Thread Emmanuel Charpentier,,,
Hiroshi Inoue wrote : [ ... ] Column order isn't essential in rdbms. Nitpicking A relation (a table) is a subset of the Cartesain cross-product of the definition domains of the attributes (columns). Cartesian product being a commutative operation, "order of columns" does not really exists.

Re: [HACKERS] Tuple data

2000-12-17 Thread Hannu Krosing
Tom Lane wrote: ALTER ADD COLUMN doesn't touch any tuples, and you're right that it's critically dependent on heap_getattr returning NULL when an attribute beyond the number of attributes actually present in a tuple is accessed. That's a fragile and unclean implementation IMHO --- see past

Re: [HACKERS] Tuple data

2000-12-17 Thread Hiroshi Inoue
Hannu Krosing wrote: Tom Lane wrote: ALTER ADD COLUMN doesn't touch any tuples, and you're right that it's critically dependent on heap_getattr returning NULL when an attribute beyond the number of attributes actually present in a tuple is accessed. That's a fragile and unclean

Re: [HACKERS] Tuple data

2000-12-17 Thread Tom Lane
Hiroshi Inoue [EMAIL PROTECTED] writes: Tom Lane wrote: ALTER ADD COLUMN doesn't touch any tuples, and you're right that it's critically dependent on heap_getattr returning NULL when an attribute beyond the number of attributes actually present in a tuple is accessed. That's a fragile and

Re: [HACKERS] Tuple data

2000-12-17 Thread Michael Richards
i Inoue" [EMAIL PROTECTED] Cc: "Hannu Krosing" [EMAIL PROTECTED]; "Michael Richards" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, December 17, 2000 8:05 PM Subject: Re: [HACKERS] Tuple data Hiroshi Inoue [EMAIL PROTECTED] writes: Tom Lane wrote: ALTER ADD COLUMN do

Re: [HACKERS] Tuple data

2000-12-17 Thread Tom Lane
"Michael Richards" [EMAIL PROTECTED] writes: What are the cases where the current implementation does not handle it properly? Inheritance. CREATE TABLE parent (a, b, c); CREATE TABLE child (z) INHERITS (parent); ALTER TABLE parent ADD COLUMN (d); With the current implementation you now

Re: [HACKERS] Tuple data

2000-12-17 Thread Hiroshi Inoue
Tom Lane wrote: Hiroshi Inoue [EMAIL PROTECTED] writes: Tom Lane wrote: ALTER ADD COLUMN doesn't touch any tuples, and you're right that it's critically dependent on heap_getattr returning NULL when an attribute beyond the number of attributes actually present in a tuple is accessed.

Re: [HACKERS] Tuple data

2000-12-17 Thread Michael Richards
This is what I assumed the problem to be but I wasn't sure if there would be more to it or not. My question now is: Should the order in which columns are physically stored matter? Since the details of where to find the columns in the tuple data are stored in pg_attribute, I'd think this is a

[HACKERS] Tuple data

2000-12-16 Thread Michael Richards
Hi. I've still got something I can't seem to get. In my test cases with simple tables the first uint16 of tuple data after the header contained the length of the tuple. In this case I can't seem to figure out what the value F24D stands for when I'd expect it's length to be 0800. The first tuple

Re: [HACKERS] Tuple data

2000-12-16 Thread Tom Lane
"Michael Richards" [EMAIL PROTECTED] writes: I've still got something I can't seem to get. In my test cases with simple tables the first uint16 of tuple data after the header contained the length of the tuple. That's not right --- AFAIR there is no length in the tuple data. You must use the

Re: [HACKERS] Tuple data

2000-12-16 Thread Hannu Krosing
Michael Richards wrote: Hi. I've still got something I can't seem to get. In my test cases with simple tables the first uint16 of tuple data after the header contained the length of the tuple. In this case I can't seem to figure out what the value F24D stands for when I'd expect it's

Re: [HACKERS] Tuple data

2000-12-16 Thread Hannu Krosing
Michael Richards wrote: That's not right --- AFAIR there is no length in the tuple data. You must use the length from the 'page item' pointer that points to this tuple if you want to know the total tuple length. Oops, I meant attribute length... If you were testing with tables

Re: [HACKERS] Tuple data

2000-12-16 Thread Michael Richards
I'm not sure, but you may see some part of the NULL bitmap. IIRC it started at a quite illogical place, is suspect it was at byte 31 but it still reserved 4bytes for each 32 fields after byte 32 Sometimes the t_hoff value in the tuple header is 32 which seems to indicate no NULL bitmap. This

Re: [HACKERS] Tuple data

2000-12-16 Thread Tom Lane
pg_attribute tells you the types and ordering of the attributes (columns) of a table. Then see pg_type for the size and alignment of each type. regards, tom lane

Re: [HACKERS] Tuple data

2000-12-16 Thread Tom Lane
"Michael Richards" [EMAIL PROTECTED] writes: Sometimes the t_hoff value in the tuple header is 32 which seems to indicate no NULL bitmap. There's no null bitmap unless the HASNULLS infomask bit is set. This really makes me wonder what happens when you ALTER TABLE ADD COLUMN on a table since