Search Postgresql Archives

Re: INSERT doc discrepancy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kristo Kaiv wrote:
> INSERT INTO table [ ( column [, ...] ) ]
>     { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] 
> | query }
>     [ RETURNING * | output_expression [ AS output_name ] [, ...] ]
>
> but it seems if i want to return the result into a record i have to use it 
> with INTO clause in the end:
>
>         INSERT INTO tablename (
>              a
>             ,b
>             ,c
>         ) VALUES (
>              in_a
>             ,in_b
>             ,in_c
>         ) RETURNING * INTO _r;

Where's the discrepancy?  INTO is not supported in the RETURNING clause.

... thinks for a while ...

Ah, you are using it in plpgsql!  OK, but the explanation to the
discrepancy is that the second INTO is not part of the SQL sentence;
it's plpgsql only, and is parsed by its internal parser, so not really
part of the SQL grammar.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux