Re : pg_dump, serial

Поиск
Список
Период
Сортировка
Искать

Re : pg_dump, serial

От:
Laurent ROCHE <laurent_roche@yahoo.com>
Дата:
Hi Tom,

I have read the given links, and I understand the reasons.

Still, I am a bit surprised to see no mention of this in the documentation of pg_dump. I would expect to see at least a line stating that the colum declared with SERIAL will transformed to a SEQUENCE.

I understand the point that pg_dump is there to recreate a database (so the file generated is to be read by pg_restore). But developers also need a tool to reverse engineer a database and to get the creation scripts into file(s) to be read by humans, to easily have an overall view of the database ... and to be able to easily tweak it (I often change colums oreders in that script). So to me, pg_dump has two missions: 
 - to create files to be used by pg_restore (format = c or t) 
 - to create SQL scripts (format = p) to be read by developers and to be modified by them.

It would have been nice to retain the possibility to have script with SERIAL (via an option), at the user risk (and maybe if possible with warnings of potential problems for GRANT, etc ...).
As far as I am concerned, I am not in the situation of having problems for using SERIAL (GRANT ...), and I prefer scripts with SERIAL as they are easier to read by a human, and also by programs (I have parsers looking for SERIAL to generate code for my Derby db).

I don't want to start a war here, just giving ideas and the way I see things coming from other RDBMs (Sybase, SQL-Server, Oracle).

 
Have fun,
L@u
The Computing Froggy

----- Message d'origine ----
De : Tom Lane 
À : Laurent ROCHE 
Cc : pgsql-general@postgresql.org
Envoyé le : Vendredi, 2 Mars 2007, 17h03mn 18s
Objet : Re: [GENERAL] pg_dump, serial 

Laurent ROCHE  writes:
> I understand (and I have read) that there have been changes and discussions about the way, pg_dump treats SERIAL columns in the latest versions(8.x).
> However, I have not been able to get a document explaining exactly what the changes are and what's the reasoning behind it, not even in the documentation.
> Is there such a thing ?

See this thread and the earlier ones it refers to:
http://archives.postgresql.org/pgsql-hackers/2006-08/msg01250.php
The commit message here summarizes the changes:
http://archives.postgresql.org/pgsql-committers/2006-08/msg00376.php

            regards, tom lane





	

	
		
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com

Re: Re : pg_dump, serial

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Laurent ROCHE  writes:
> I have read the given links, and I understand the reasons.

> Still, I am a bit surprised to see no mention of this in the documentation of pg_dump. I would expect to see at least a line stating that the colum declared with SERIAL will transformed to a SEQUENCE.

There is no place in the pg_dump documentation where anything is
promised about the content of the scripts it emits, except that when
executed they are supposed to regenerate the content of your database.
We have always felt free to alter the exact commands that are issued to
accomplish that.  This case is not noticeably different from previous
pg_dump changes AFAICS.

In any case, the documentation of SERIAL itself makes the equivalence
clear enough:
http://www.postgresql.org/docs/8.2/static/datatype-numeric.html#DATATYPE-SERIAL

			regards, tom lane
FAQ