From: | "Don Morrison" <donmorrison(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Using SERIAL Column Type While Creating Some_List Table |
Date: | 2006-08-11 15:32:53 |
Message-ID: | aee6519f0608110832v34b77c30nb537b52edce0e4c6@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)gmail(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Keith Worthington | 2006-08-11 15:48:51 | Re: executing a procedure withing a procedure? |
Previous Message | ben sewell | 2006-08-11 15:12:58 | executing a procedure withing a procedure? |