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

Re: table alias

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: <Bob(dot)Henkel(at)hartfordlife(dot)com>
Cc: <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: table alias
Date: 2004-05-25 14:20:54
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB34101AE37@Herge.rcsinc.local (view raw or flat)
Thread:
Lists: pgsql-hackers-win32
> I'm running a binary snapshot from two days ago.  When I run a update
with
> aliases the SQL doesn't work.  The alias does work if I run just a
select
> statement however.  Is this suppose to be like this.  If not is it
only
> broken in the 7.5 WIN32 build?

Look at the grammar for select and update (\h update, \h select) in
psql.  You will notice that select has grammar for alias, update does
not

where from_item can be one of:

    [ ONLY ] table_name [ * ] [ [ AS ] alias [ ( column_alias [, ...] )
] ]
    ( select ) [ AS ] alias [ ( column_alias [, ...] ) ]
    function_name ( [ argument [, ...] ] ) [ AS ] alias [ ( column_alias
[, ...] | column_definition

there is no reason to alias the update statement because you can only
specify one table, so it is not really necessary to prefix each column
with the table name (and thus no reason for an alias).  I didn't check,
but the unix version almost certainly works the same

Merlin


pgsql-hackers-win32 by date

Next:From: Bob.HenkelDate: 2004-05-25 14:43:47
Subject: Re: table alias
Previous:From: Bob.HenkelDate: 2004-05-25 13:36:32
Subject: table alias

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