pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jackson, DeJuan <djackson@cpsgroup.com>
To: Chris Bitmead <chris.bitmead@bigfoot.com>
To: pgsql-sql@postgreSQL.org
Subject: RE: [SQL] UPDATE subselect?
Date: Fri, 16 Apr 1999 11:35:21 -0500
Message-ID: <D05EF808F2DFD211AE4A00105AA1B5D20B8986@cpsmail> (raw)

try:
 UPDATE category
 SET parent[0] = mfr.oid
 FROM mfr
 WHERE mfr.name='canon';

	-DEJ

> José Soares wrote:
> > 
> > Take a look at PostgreSQL User's Guide
> > Chapter 10. Arrays
> 
> Which doesn't help me because I need to update individual array elements
> from subselects.
> 
> > 
> > syntax:
> > INSERT INTO SAL_EMP
> >     VALUES ('Bill',
> >     '{10000, 10000, 10000, 10000}',
> >     '{{"meeting", "lunch"}, {}}');
> > 
> > José
> > 
> > Chris Bitmead ha scritto:
> > 
> > > What is the correct syntax for this UPDATE?
> > >
> > > CREATE TABLE category (
> > >   name text,
> > >   image text,
> > >   url text,
> > >   parent oid[]
> > > );
> > > update category set parent = '{0,0}' where name='slr';
> > > So far so good...
> > > update category set parent[0] = (SELECT oid from mfr where
> > > name='canon');
> > > ERROR:  parser: parse error at or near "select"
> > >
> > > --
> > > Chris Bitmead
> > > http://www.bigfoot.com/~chris.bitmead
> > > mailto:chris.bitmead@bigfoot.com
> 
> -- 
> Chris Bitmead
> http://www.bigfoot.com/~chris.bitmead
> mailto:chris.bitmead@bigfoot.com



view thread (4+ messages)

Message-ID: <D05EF808F2DFD211AE4A00105AA1B5D20B8986@cpsmail>
Permalink:  ../D05EF808F2DFD211AE4A00105AA1B5D20B8986@cpsmail/
Also on:    postgresql.org/message-id/D05EF808F2DFD211AE4A00105AA1B5D20B8986@cpsmail

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: djackson@cpsgroup.com, chris.bitmead@bigfoot.com
  Subject: Re: [SQL] UPDATE subselect?
  In-Reply-To: <D05EF808F2DFD211AE4A00105AA1B5D20B8986@cpsmail>
  References: <D05EF808F2DFD211AE4A00105AA1B5D20B8986@cpsmail>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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