Skip site navigation (1) Skip section navigation (2)

Special column trivia

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Subject: Special column trivia
Date: 2010-06-06 07:18:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-docs
I was just reading 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;

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 
and "Composite Value Input" at 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


pgsql-docs by date

Next:From: Tom LaneDate: 2010-06-06 10:30:15
Subject: Re: Special column trivia
Previous:From: Nikolay SamokhvalovDate: 2010-06-04 09:51:01
Subject: More clearly on XML namespaces inside xpath function

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group