From: | Darren Duncan <darren(at)darrenduncan(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | Christian Hammers <ch(at)lathspell(dot)de> |
Subject: | Re: custom session variables? |
Date: | 2013-04-25 00:47:36 |
Message-ID: | 51787D28.3080006@darrenduncan.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thank you for that.
I had actually thought of this, but it seemed to me that using a temporary table
was a heavy-handed approach and that a temporary scalar variable would be more
efficient or less verbose to use.
It is *a* solution certainly, and potentially a better one than the url I
pointed to, but I was hoping for something less bulky.
Granted, I realize that sequence generators are basically small tables like this
behind the scenes, but is there any appreciable overhead of creating and
dropping a temporary table for every session?
-- Darren Duncan
On 2013.04.24 5:07 PM, Christian Hammers wrote:
> Hello
>
> You could just use temporary tables like:
>
> BEGIN;
> CREATE TEMPORARY TABLE csid (i int);
> -- somehow write the ID you want into that table
> -- and then...
> INSERT INTO other_table (changeset_ids, msg) VALUES
> ((SELECT i FROM csid), 'Some log message');
> COMMIT;
>
> When inserting a new changeset, you fill the temporary table
> afterwards with curval('changeset_id_seq'). If you just want
> to add more referring lines, you seem to know the ID already
> can can just insert it. In any case, the following INSERTs into
> the "other tables" will look exactly the same, which seem to
> be your goal.
>
> bye,
>
> -christian-
From | Date | Subject | |
---|---|---|---|
Next Message | S H | 2013-04-25 01:48:14 | Re: Regarding template1 database |
Previous Message | Christian Hammers | 2013-04-25 00:07:26 | Re: custom session variables? |