Re: dblink (INSERT ..... RETURNING)

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: dblink (INSERT ..... RETURNING)
Date: 2012-01-20 08:32:58
Message-ID: 4F1926BA.5030405@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/20/12 12:20 AM, P. Broennimann wrote:
>
> I need now to insert a record in that remote table and get back the
> new primary field (autoincrement sequence).
>
> Since "bdlink_exec" can not give back rows I tried to use "dblink",
> but I can not figure out how to format that INSERT... RETURNING query?
>

INSERT iNTO tablename (cols) VALUES (stuff) RETURNING
currval('sequencename');

--
john r pierce N 37, W 122
santa cruz ca mid-left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Prodan, Andrei 2012-01-20 10:09:09 Timestamp with time zone 'negative' problem
Previous Message Florian Weimer 2012-01-20 08:27:55 Re: On duplicate ignore