Re: Using SERIAL Column Type While Creating Some_List Table - Mailing list pgsql-novice

From Don Morrison
Subject Re: Using SERIAL Column Type While Creating Some_List Table
Date
Msg-id aee6519f0608110832v34b77c30nb537b52edce0e4c6@mail.gmail.com
Whole thread Raw
List pgsql-novice
To clarify:

1) The INTERVAL type is NOT the element type I'm going to use, I just
gave it as an example, and a bad example at that.

2) The list is unordered.

On 8/10/06, Don Morrison <donmorrison@gmail.com> wrote:
> Hello All,
>
> I am creating a table to store a list of arbitrary length.  The
> element type of what I'm storing in the list is irrelevant to my
> question, but I include it for the purpose of discussion.  Consider
> the following:
>
> CREATE TABLE Task_Date_Interval_List (
> list_id SERIAL,
> inclusive_date_interval INTERVAL
> );
>
> I'm using Postgres 7.4.13 (if that matters).
>
> Question: How do I insert an entire list at a time, using the next
> autoincrement value?
>
> For example, assuming the next autoincrement value is 5, the hardcoded
> method is:
>
> INSERT INTO Task_Date_Interval_List (list_id, inclusive_date_interval) VALUES
> (5,some_time_interval_a), (5,some_time_interval_b),
> (5,some_time_interval_c) ... etc. ... ;
>
> I know that I have to use the COPY command instead of INSERT, but the
> above is just an example to show that I need the list_id for each
> element to be the same for all elements in the list, and I need it to
> be the next autoincrement value.
>
> Do I need to write a stored procedure to do this?
>
> Thanks!
> Don
>

pgsql-novice by date:

Previous
From: "ben sewell"
Date:
Subject: executing a procedure withing a procedure?
Next
From: Keith Worthington
Date:
Subject: Re: executing a procedure withing a procedure?