agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Michael Schmidt <css.liquid@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: How to script inserts where id is needed as fk
Date: Sun, 10 Nov 2013 00:20:59 +0100
Message-ID: <527EC35B.6000809@gmail.com> (raw)
In-Reply-To: <1384034116071-5777610.post@n5.nabble.com>
References: <527D3F2A.6060504@gmail.com>
	<05069440-C45F-4763-81A8-E14B5CB1CCB5@excoventures.com>
	<527E968E.8010807@gmail.com>
	<1384034116071-5777610.post@n5.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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-tp5777525p577...
> 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!


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (6+ messages)

Message-ID: <527EC35B.6000809@gmail.com>
Permalink:  ../527EC35B.6000809@gmail.com/
Also on:    postgresql.org/message-id/527EC35B.6000809@gmail.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: css.liquid@gmail.com
  Subject: Re: How to script inserts where id is needed as fk
  In-Reply-To: <527EC35B.6000809@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox