Re: Duplicate key insert question

Поиск
Список
Период
Сортировка
От Jean-Christian Imbeault
Тема Re: Duplicate key insert question
Дата
Msg-id 3F024CC8.8000403@mega-bucks.co.jp
обсуждение исходный текст
Ответ на Duplicate key insert question  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Ответы Re: Duplicate key insert question  ("Reuben D. Budiardja" <techlist@voyager.phys.utk.edu>)
Re: Duplicate key insert question  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
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


Did I get the syntax wrong?

Thanks,

Jean-Christian Imbeault


В списке pgsql-general по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: postgresql.org is unreliable
Следующее
От: "Reuben D. Budiardja"
Дата:
Сообщение: Re: Duplicate key insert question