Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-28 Thread Nikolay Samokhvalov
On 2/7/06, Martijn van Oosterhout wrote: > On Tue, Feb 07, 2006 at 03:28:31PM +0300, Nikolay Samokhvalov wrote: > > The real situation would be as the following. > > I want to use some algorithm to hide real number of registered users > > in my table user. So, I don't want to use simple sequence,

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-10 Thread Bruno Wolff III
On Fri, Feb 10, 2006 at 07:34:35 -0500, Doug McNaught <[EMAIL PROTECTED]> wrote: > Bruno Wolff III <[EMAIL PROTECTED]> writes: > > Or, just start your sequence counting at 100. Or use bigint and > start it at a billion. That may work if you only have access to one id number, but you don't

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-10 Thread Doug McNaught
Bruno Wolff III <[EMAIL PROTECTED]> writes: > On Tue, Feb 07, 2006 at 15:28:31 +0300, > Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: >> The real situation would be as the following. >> I want to use some algorithm to hide real number of registered users >> in my table user. So, I don't want to

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-09 Thread Bruno Wolff III
On Tue, Feb 07, 2006 at 15:28:31 +0300, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: > The real situation would be as the following. > I want to use some algorithm to hide real number of registered users > in my table user. So, I don't want to use simple sequence, when every > new registered us

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-08 Thread Bruce Momjian
Joachim Wieland wrote: > On Wed, Feb 08, 2006 at 09:03:54AM -0500, Bruce Momjian wrote: > > Joachim Wieland wrote: > > > On Tue, Feb 07, 2006 at 09:49:02AM -0500, Bruce Momjian wrote: > > > > > The correct solution to this is to forbid ALTER COLUMN SET DEFAULT on > > > > > a serial column, but we h

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-08 Thread Joachim Wieland
On Wed, Feb 08, 2006 at 09:03:54AM -0500, Bruce Momjian wrote: > Joachim Wieland wrote: > > On Tue, Feb 07, 2006 at 09:49:02AM -0500, Bruce Momjian wrote: > > > > The correct solution to this is to forbid ALTER COLUMN SET DEFAULT on > > > > a serial column, but we haven't gotten around to enforcing

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-08 Thread Bruce Momjian
Joachim Wieland wrote: > On Tue, Feb 07, 2006 at 09:49:02AM -0500, Bruce Momjian wrote: > > > The correct solution to this is to forbid ALTER COLUMN SET DEFAULT on > > > a serial column, but we haven't gotten around to enforcing that yet. > > > TODO has: > > > * %Disallow changing default exp

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-08 Thread Joachim Wieland
On Tue, Feb 07, 2006 at 09:49:02AM -0500, Bruce Momjian wrote: > > The correct solution to this is to forbid ALTER COLUMN SET DEFAULT on > > a serial column, but we haven't gotten around to enforcing that yet. > TODO has: > * %Disallow changing default expression of a SERIAL column This sh

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Nikolay Samokhvalov
There is no SERIAL type in the standard at all. Moreover, standard defines following expression for SEQUENCE GENERATORs: ::= NEXT VALUE FOR Postgres has non-standard equivalent - nextval()... So, sequences implementation in PostgreSQL isn't standard-compliant. On 2/7/06, John D. Burger <[EMAI

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Tom Lane
"John D. Burger" <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> The correct solution to this is to forbid ALTER COLUMN SET DEFAULT on >> a serial column, but we haven't gotten around to enforcing that yet. > Is this per the Standard? SERIAL isn't in the standard. > If so, then the oft-repeated

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread John D. Burger
Tom Lane wrote: The correct solution to this is to forbid ALTER COLUMN SET DEFAULT on a serial column, but we haven't gotten around to enforcing that yet. Is this per the Standard? If so, then the oft-repeated mantra that SERIAL is simply a macro for an INTEGER column with a particular DEFA

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Tom Lane
Nikolay Samokhvalov <[EMAIL PROTECTED]> writes: > Forget about SERIAL. I have INTEGER column with some expression as > DEFAULT in it. No, you have a SERIAL column that you've improperly mucked with the implementation of. If you'd declared it as INTEGER to start with, you could do whatever you wan

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Bruce Momjian
Nikolay Samokhvalov wrote: > On 2/7/06, Tom Lane <[EMAIL PROTECTED]> wrote: > > Nikolay Samokhvalov <[EMAIL PROTECTED]> writes: > > > testseq=# CREATE TABLE test(id SERIAL, data TEXT); > > > NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for > > > serial column "test.id" > > > CR

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Nikolay Samokhvalov
On 2/7/06, Tom Lane <[EMAIL PROTECTED]> wrote: > Nikolay Samokhvalov <[EMAIL PROTECTED]> writes: > > testseq=# CREATE TABLE test(id SERIAL, data TEXT); > > NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for > > serial column "test.id" > > CREATE TABLE > > *** > > ALTER TABLE test

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Bruce Momjian
Tom Lane wrote: > Nikolay Samokhvalov <[EMAIL PROTECTED]> writes: > > testseq=# CREATE TABLE test(id SERIAL, data TEXT); > > NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for > > serial column "test.id" > > CREATE TABLE > > *** > > ALTER TABLE test ALTER COLUMN id SET DEFAULT ne

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Tom Lane
Nikolay Samokhvalov <[EMAIL PROTECTED]> writes: > testseq=# CREATE TABLE test(id SERIAL, data TEXT); > NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for > serial column "test.id" > CREATE TABLE > *** > ALTER TABLE test ALTER COLUMN id SET DEFAULT nextval('test_id_seq') * 10; Th

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Martijn van Oosterhout
On Tue, Feb 07, 2006 at 03:28:31PM +0300, Nikolay Samokhvalov wrote: > The real situation would be as the following. > I want to use some algorithm to hide real number of registered users > in my table user. So, I don't want to use simple sequence, when every > new registered user in my system can

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Nikolay Samokhvalov
On 2/7/06, Martijn van Oosterhout wrote: > On Tue, Feb 07, 2006 at 02:33:56PM +0300, Nikolay Samokhvalov wrote: > Well, it's a very contrived example (I can't think of a reason why one > would do that) but I agree it is a bug. You could acheive the same > effect by setting the step of the sequenc

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-07 Thread Martijn van Oosterhout
On Tue, Feb 07, 2006 at 02:33:56PM +0300, Nikolay Samokhvalov wrote: > Maybe it was discussed already, but I think it's very strange behavior > and things should be changed (please correct me if I'm wrong) > > Suppose we have database containing only one simple table: > So, if we don't know the