public inbox for [email protected]  
help / color / mirror / Atom feed
Special column trivia
3+ messages / 3 participants
[nested] [flat]

* Special column trivia
@ 2010-06-06 07:18 Greg Smith <[email protected]>
  2010-06-06 10:30 ` Re: Special column trivia Tom Lane <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Greg Smith @ 2010-06-06 07:18 UTC (permalink / raw)
  To: pgsql-docs

I was just reading 
http://www.postgresql.org/docs/9.0/static/ddl-system-columns.html and 
noted that the second part about the ctid being unstable:  "a row's ctid 
will change if it is updated or moved by VACUUM FULL" is probably not 
true anymore.  Is that worth updating?

What got me reading that section was a rather weird documentation 
question/addition from Edmund Horner.  He noted that the following works 
on PG8.4 and 9.0:

postgres=# select (row(1,2)).name;
 name 
-------
 (1,2)

Having not worked on earlier versions (this from 8.3):

postgres=# select (row(1,2)).name;
ERROR:  could not identify column "name" in record data type

I didn't see anything that documents the ability to use "name" to refer 
to the composite record like this.  Since it's not an area of the code 
I'm familiar with, so I'm just baffled as Edmund.  "Row Constructors" at 
http://www.postgresql.org/docs/current/interactive/sql-expressions.html 
and "Composite Value Input" at 
http://www.postgresql.org/docs/current/interactive/rowtypes.html both 
seem relevant, but don't seem to explain what's happening.  That second 
one is where he pointed out confusion can really creep in, because 
"name" is also a field in the inventory_item table, which makes it 
particularly easy for a coding error to refer to the wrong thing oddly.

-- 
Greg Smith  2ndQuadrant US  Baltimore, MD
PostgreSQL Training, Services and Support
[email protected]   www.2ndQuadrant.us




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Special column trivia
  2010-06-06 07:18 Special column trivia Greg Smith <[email protected]>
@ 2010-06-06 10:30 ` Tom Lane <[email protected]>
  2010-06-10 22:00   ` Re: Special column trivia Bruce Momjian <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2010-06-06 10:30 UTC (permalink / raw)
  To: Greg Smith <[email protected]>; +Cc: pgsql-docs

Greg Smith <[email protected]> writes:
> I was just reading 
> http://www.postgresql.org/docs/9.0/static/ddl-system-columns.html and 
> noted that the second part about the ctid being unstable:  "a row's ctid 
> will change if it is updated or moved by VACUUM FULL" is probably not 
> true anymore.  Is that worth updating?

It's still true.  VACUUM FULL still reassigns ctids.

> What got me reading that section was a rather weird documentation 
> question/addition from Edmund Horner.  He noted that the following works 
> on PG8.4 and 9.0:

> postgres=# select (row(1,2)).name;

This is the cast-a-composite-type-to-string-type issue that's come up in
several guises before, eg most recently at
http://archives.postgresql.org/pgsql-general/2010-05/msg01126.php

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Special column trivia
  2010-06-06 07:18 Special column trivia Greg Smith <[email protected]>
  2010-06-06 10:30 ` Re: Special column trivia Tom Lane <[email protected]>
@ 2010-06-10 22:00   ` Bruce Momjian <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2010-06-10 22:00 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Greg Smith <[email protected]>; pgsql-docs

Tom Lane wrote:
> > What got me reading that section was a rather weird documentation 
> > question/addition from Edmund Horner.  He noted that the following works 
> > on PG8.4 and 9.0:
> 
> > postgres=# select (row(1,2)).name;
> 
> This is the cast-a-composite-type-to-string-type issue that's come up in
> several guises before, eg most recently at
> http://archives.postgresql.org/pgsql-general/2010-05/msg01126.php

Do we need additional documentation?

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + None of us is going to be here forever. +




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2010-06-10 22:00 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-06-06 07:18 Special column trivia Greg Smith <[email protected]>
2010-06-06 10:30 ` Tom Lane <[email protected]>
2010-06-10 22:00   ` Bruce Momjian <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox