Re: What is the name pseudo column

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: David Fetter <david(at)fetter(dot)org>, Jack Christensen <jackc(at)hylesanderson(dot)edu>
Subject: Re: What is the name pseudo column
Date: 2010-12-15 23:43:45
Message-ID: 201012151543.45559.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 15 December 2010 1:27:19 pm David Fetter wrote:
> On Wed, Dec 15, 2010 at 01:50:54PM -0600, Jack Christensen wrote:
> > I was just surprised when accidentally selecting a non-existent name
> > column there was no error -- instead something came back.
> >
> > select accounts.name from accounts limit 1 ->
> > (1,65522,1,0.00,,"2010-07-22 09:57:26.281172-05",2)
> >
> > It appears it tries to return the entire row in an array (but longer
> > rows get truncated).
> >
> > I've searched Google and the PG docs but I haven't had any luck.
>
> What happened here is that you ran into PostgreSQL's "charming" habit
> of using the argument.function notation, so you called the "name"
> function, i.e. the one that casts to name, on the entire row from your
> accounts table.
>
> Cheers,
> David.
>

In the for what is worth department that behavior is going away in 9.1. See here
for a detailed explanation:
http://www.depesz.com/index.php/2010/11/08/waiting-for-9-1-removed-autocast-footgun/#more-1908
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2010-12-15 23:52:03 Re: What is the name pseudo column
Previous Message Paolo Saul 2010-12-15 23:07:20 Autovacuum running although set to off, and wraparound limit has not been reached