Re: Quick question

Поиск
Список
Период
Сортировка
От Brent Verner
Тема Re: Quick question
Дата
Msg-id 20011113125904.A7508@rcfile.org
обсуждение исходный текст
Ответ на Re: Quick question  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Quick question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 13 Nov 2001 at 12:33 (-0500), Bruce Momjian wrote:
| > On 13 Nov 2001 at 18:00 (+0800), Christopher Kings-Lynne wrote:
| > | Could someone please give me a quick tip as to where in the source code the
| > | bit that auto-generates sequence names is?
| > 
| > I used cscope (http://cscope.sourceforge.net/) and did a text search
| > for 'implicit sequence'.  A bit of backtracking from there led me to
| > src/backend/parser/anaylyz.c:783
| >    sname = makeObjectName(cxt->relname, column->colname, "seq");
| > 
| > That function is in the same file, and has some comments related to
| > name collision above it.  I believe this is where you'll want to work.
| 
| I think we handled this.  Have you tried 7.2 beta2?

I believe the following demonstrates the problem Christopher would
like to solve.

brent=# select version();                           version                            
---------------------------------------------------------------PostgreSQL 7.2b2 on i686-pc-linux-gnu, compiled by GCC
2.95.4
(1 row)

brent=# create table test (id serial);
NOTICE:  CREATE TABLE will create implicit sequence 'test_id_seq' for SERIAL column 'test.id'
NOTICE:  CREATE TABLE / UNIQUE will create implicit index 'test_id_key' for table 'test'
ERROR:  Relation 'test_id_seq' already exists

 ISTM, that these sequences created by way of a SERIAL type should 
be named "pg_serial_test_id_HASH" or similar, since they are system
(bookkeeping) rels.  Also, I /personally/ would like it if the sequence
was dropped along with the table using it, provided that no other atts 
in the system are using it.  I'm not sure right now if this behavior
is even feasible.
 That said, there is certainly immediate benefit in making sure the 
CREATE TABLE with a SERIAL will succeed if the (initial choice for) 
sequence name already exists.

cheers. brent

-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Open items
Следующее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: fts.postgresql.org problem ! still no routing