From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Anand B Kumar <akumar(at)addr(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Please clarify with regard to Renaming a Sequence |
Date: | 2003-03-22 06:51:48 |
Message-ID: | 20030322065148.GB12633@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On Fri, Mar 21, 2003 at 08:08:59PM +0530, Anand B Kumar wrote:
> Dear Sirs,
>
> We are working on Postgresql for one of our on going project. We have come across a situation as mentioned below.
>
> 1. We have to create a table with sequence dynamically from the front end ( through a JSP code)
> 2. An option for the user is given to change the name of the table in the front end. During this process, we change the name of the table and its relative sequence too. But the table which was first created with a sequence has its property written in its property field. Now if we change that property in that field, will the sequence gets disturbed??
>
> For say, I create a table 'addrtech' which has two fields, empid and empname
> 2. The emp id has a sequence created dynamically. so a sequence name addrtech_empid_seq is created.
> 3. The field empid in addrtech has in its DEFAULT column as " nextval('"addrtech_empid_seq"'::text) "
> 4. Now I rename addrtech to addrtechnology
> 5. So the table is altered
> 6. The sequence is also altered as addrtechnology_empid_seq and the new table is addrtechnology
>
> But the doubt now is the field which has the sequence i.e the empid which has nextval('"addrtech_empid_seq"'::text) . The property if changed to nextval('"addrtechnology_empid_seq"'::text) will the seqeunce remain the same. Meaning if it had some few million records in the orginial table addrtech and if additional data is entere to addrtechnology will the sequence continue.
>
> Please clarify this query of mine at the earliest so that we can incorporate the same in our codes
The database won't update the default for you, you'll have to do that
yourself with ALTER TABLE SET DEFAULT.
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> IT is not something like pizza that you order in at one o'clock in
> the morning. - John Loebenstein, St George CIO
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2003-03-22 07:14:07 | Re: table function: limit, offset, order |
Previous Message | Tom Lane | 2003-03-22 06:37:52 | Re: does vacuum still lock the table? |
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2003-03-22 08:22:56 | Re: Please clarify with regard to Renaming a Sequence |
Previous Message | Tom Lane | 2003-03-22 05:26:04 | Re: PQescapeBytea on Win32 |