Re: How to script inserts where id is needed as fk

From: Michael Schmidt <css(dot)liquid(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to script inserts where id is needed as fk
Date: 2013-11-09 23:20:59
Message-ID: 527EC35B.6000809@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Am 09.11.2013 22:55, schrieb David Johnston:
> Michael Schmidt-2 wrote
>> To extend my scenario a little bit i have a third level called
>> 'Incredient' and they need the Article id. I dont think this will work
>> anymore with the with clause. Any new approaches?
> Why don't you just use a procedural language function? plpgsql should be
> sufficient for most requirements.
>
> David J.
>
>
>
>
> --
> View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-script-inserts-where-id-is-needed-as-fk-tp5777525p5777610.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
>
My solution will be using select currval('atricle_id_seq') for the
script. PL/pgSQL will be the nicer solution cause you can store the id
and you dont need to select it all the time.

Thanks all!

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Sergey Konoplev 2013-11-10 23:40:01 Re: Find datatype of a column during the backend flow
Previous Message David Johnston 2013-11-09 21:55:16 Re: How to script inserts where id is needed as fk