Re: PGSQL returning into in insert statement

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PGSQL returning into in insert statement
Дата
Msg-id 1352566.1596078339@sss.pgh.pa.us
обсуждение исходный текст
Ответ на PGSQL returning into in insert statement  (Chamath Sajeewa <csgsajeewa@gmail.com>)
Ответы Re: PGSQL returning into in insert statement
Список pgsql-novice
Chamath Sajeewa <csgsajeewa@gmail.com> writes:
> I want to use "returning into" in insert statement. I tried below,

> insert into test_table(key,value) values('key1',5) returning value into
> returnvalue;

> and below error occurred- syntax error at or near "into".

That is perfectly legit syntax within a plpgsql function, but it
would produce the mentioned syntax error if you tried to use it
directly at the SQL level.  So I conclude that you're fuzzy about
the difference between SQL and plpgsql.  You can use plpgsql
statements within plpgsql-language function definitions, and
within DO blocks.  But not as plain SQL.  (Plain SQL has no concept
of variables either, so "into returnvalue" makes no sense there
anyway.)

            regards, tom lane



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

Предыдущее
От: Chamath Sajeewa
Дата:
Сообщение: PGSQL returning into in insert statement
Следующее
От: Chamath Sajeewa
Дата:
Сообщение: Re: PGSQL returning into in insert statement