From: | mikeo <mikeo(at)spectrumtelecorp(dot)com> |
---|---|
To: | "John McKown" <newsuser(at)linux2(dot)johnmckown(dot)net>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Re: Simple search question |
Date: | 2000-06-20 17:09:56 |
Message-ID: | 3.0.1.32.20000620130956.00921820@pop.spectrumtelecorp.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
do
select setval('seqname',#);
At 01:17 PM 6/15/00 -0500, John McKown wrote:
>
>Alex wrote in message <39487DD3(dot)7F2BBAE1(at)ihug(dot)com(dot)au>...
>>Hi,
>>
>>> I had the same problem but was using Java, not PHP (I guess that
>>> whatever I can do in JDBC, you can do in PHP ;-)).
>>>
>>> SELECT last_value FROM <sequence>;
>>
>>This brings me back to another unanswered question recently posted up,
>maybe
>>it is impossible...
>>I declared a new table with one of the types as serial (which is really
>just a
>>sort of macro I believe, which automates the creation of a few things for
>your
>>convenience), which initialises the last_value of the relation (the
>sequence
>>itself), as 1. Therefore, upon INSERTing my first row, the serial number
>began
>>at 1, next was 2, then 3, and so forth.
>> My question is, is it possible to alter the sequence last_value column, as
>>I need the serial number to begin from 1000?
>>Thanks,
>>Alex
>>
>
>Nope, I tried doing an
>
>UPDATE name-of-sequence SET last_value=200
>
>and I got an error about not being able to update the sequence. However,
>always being one to hit a brick until it cracks, I then tried:
>
>DROP name-of-sequence;
>CREATE name-of-sequence START 1000;
>
>This seemed to work! When I then INSERTed a new tuple, the attribute defined
>as SERIAL actually got the value of 1000. Curious, but nice.
>
>John McKown (note - not! Jack, but John)
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-06-20 18:16:53 | Re: BETWEEN |
Previous Message | Webb Sprague | 2000-06-20 16:56:36 | Re: \copy... |