Re: Re: nextval, sequences and sequencenames
От | Martijn van Oosterhout |
---|---|
Тема | Re: Re: nextval, sequences and sequencenames |
Дата | |
Msg-id | 20010815191613.A10244@svana.org обсуждение исходный текст |
Ответ на | Re: Re: nextval, sequences and sequencenames (Wieger Uffink <wieger@usmedia.nl>) |
Список | pgsql-general |
On Wed, Aug 15, 2001 at 10:49:38AM +0200, Wieger Uffink wrote: > Hi, > > First of all thanks for the reactions, but I think I have probably not > made my problem clear enough. > > I know the sequence name will be some combination, usually as > 'tablename_columnname_seq', > when implicitly created during table creation. > But when I create my table 'maincompetencies' with serial column > 'maincompetencid' > the sequence is named 'maincompetenc_maincompetenc_seq'. Clearly not the > same as the above mentioned naming formula. Yes, the max identifier length is 32. > I have a hunch that table and column names are cut off after the first > 13 characters, but im not sure if this is true, or will maybe change in > future versions of postgre. It's a tricky algorithm. > What I would really like to do is just query Postgre, give the tablename > and columnname in question, and retreive the exact sequencename. I know > Postgre 'knows' this, it has that info stored somewhere, it just wont > tell me :) Well, it would be stored in the default value field of the column. You could try to parse it out of there. I suggest however not using the serial keyword, but instead building it yourself. Then you could call you sequence maincompetencies_pseq or whatever you like. Parsing it out of the system tables might not work in future versions either. The only guarenteed way is to name them yourself. HTH, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > It would be nice if someone came up with a certification system that > actually separated those who can barely regurgitate what they crammed over > the last few weeks from those who command secret ninja networking powers.
В списке pgsql-general по дате отправления: