Re: the column in Update

From: John Fabiani <jfabiani(at)yolo(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: the column in Update
Date: 2004-11-10 23:27:26
Message-ID: 200411101527.26452.jfabiani@yolo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks but in the doc's it uses the term 'columnname'. The real issue is the
tablename.columnname is supported in MySQL and I'm trying to support Postgres
and MySQL with a single code routine.
John
On Wednesday 10 November 2004 03:31, Martijn van Oosterhout wrote:
> Probably because the bit after the SET is a "column-name" not a
> reference to a column. There's no point qualifying it in any way since
> the tablename is given as part of the UPDATE statement.
>
> On Tue, Nov 09, 2004 at 06:33:55PM -0800, John Fabiani wrote:
> > From the 7.4 docs:
> > A column can be referenced in the form
> >
> > correlation.columnname
> >
> > correlation is the name of a table (possibly qualified with a schema
> > name), or an alias for a table defined by means of a FROM clause, or one
> > of the key words NEW or OLD. (NEW and OLD can only appear in rewrite
> > rules, while other correlation names can be used in any SQL statement.)
> > The correlation name and separating dot may be omitted if the column name
> > is unique across all the tables being used in the current query. (See
> > also Chapter 7.)
> >
> > So then why does this not work:
> > Update tablename set tablename.columnName = 'somedata' where .....
> >
> > John
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 8: explain analyze is your friend

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2004-11-10 23:52:14 Re: the column in Update
Previous Message "Miquel van Smoorenburg" 2004-11-10 23:05:34 Re: index not always used when selecting on a date field