Unix Technical Forum

Re: Using SERIAL Column Type While Creating Some_List Table

This is a discussion on Re: Using SERIAL Column Type While Creating Some_List Table within the pgsql Novice forums, part of the PostgreSQL category; --> To clarify: 1) The INTERVAL type is NOT the element type I'm going to use, I just gave it ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 11:06 PM
Don Morrison
 
Posts: n/a
Default Re: Using SERIAL Column Type While Creating Some_List Table

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
>


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:15 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com