Re: Duplicate key insert question

From: "Reuben D(dot) Budiardja" <techlist(at)voyager(dot)phys(dot)utk(dot)edu>
To: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Duplicate key insert question
Date: 2003-07-02 03:26:46
Message-ID: 200307012326.46173.techlist@voyager.phys.utk.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 01 July 2003 11:08 pm, Jean-Christian Imbeault wrote:
> Reuben D. Budiardja wrote:
> > INSERT INTO mytable
> > SELECT 'value1', 'value2'
> > WHERE NOT EXISTS
> > (SELECT NULL FROM mytable
> > WHERE mycondition)
>
> Thank you to everyone who helped out on my question. I am trying to
> implement the above solution but I'm having problems getting this to
> work when I want to insert more than one value:
>
> TAL=# create table b (a text primary key, b text);
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'b_pkey'
> for table 'b'
> CREATE TABLE
> TAL=# insert into b select 'a';
> INSERT 335311 1
> TAL=# insert into b select 'b', select 'b';
> ERROR: parser: parse error at or near "select" at character 27
>

I don't see what you're trying to do. Why do you have two select ?

RDB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2003-07-02 03:32:40 Re: Duplicate key insert question
Previous Message Harry Yau 2003-07-02 03:20:26 test