dbTalk Databases Forums  

[BUGS] ALTER SCHEMA problem

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] ALTER SCHEMA problem in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andreas Hinz
 
Posts: n/a

Default [BUGS] ALTER SCHEMA problem - 08-14-2003 , 08:55 PM






If PostgreSQL failed to compile on your computer or you found a bug that
is likely to be specific to one platform then please fill out this form
and e-mail it to pgsql-ports (AT) postgresql (DOT) org.

To report any other bug, fill out the form below and e-mail it to
pgsql-bugs (AT) postgresql (DOT) org.

If you not only found the problem but solved it and generated a patch
then e-mail it to pgsql-patches (AT) postgresql (DOT) org instead. Please use the
command "diff -c" to generate the patch.

You may also enter a bug report at http://www.postgresql.org/ instead of
e-mail-ing this form.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D
=3D=3D=3D POSTGRESQL BUG REPORT TEMPLATE
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D
=3D=3D=3D


Your name : Andreas Hinz=09
Your email address : news3 (AT) acci (DOT) dk


System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium

Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.21 ELF

PostgreSQL version (example: PostgreSQL-7.3): PostgreSQL-7.4beta1

Compiler used (example: gcc 2.95.2) : gcc 3.2.3


Please enter a FULL description of your problem:
------------------------------------------------

Hi,
I am not absolutly sure this is a bug, but consider this:

I am about to create a database with 5 schemas each containing about 70
tables. Importing data via "psql <database> -f <file>.

After import I rename the schema "public" to eg. "base1", create a=20
new schema "public", import the next database etc.

Now the problem is I yse the datatype "serial" which creates then
constraint "default nextval('public.abc_sew'::test)".

When renaming the schema from "public" to "base1" all indexes and
seqenses are renames correct, but not the above "public." in the
constraint.


Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:=20
----------------------------------------------------------------------

createdb test
psql test
CREATE TABLE ta1 (f1 serial, f2 integer);
ALTER SCHEMA public RENAME TO base1;
\d base1.*


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------


Only by manual "ALTER TABLE ta1 ALTER f1 SET DEFAULT etc.

But doing this for 5 schemas each having 70 tables is somewhat stupud.

Even via a seperate file with all the "ALTER" is no solution as this is
an unfineshed project with frequent changes on the tables and thus
possible changes in this file.


A posibility to select a default schema with eg. "SET" on import would be
a really nice feature:

SET DEFAULT SCHEMA base1;

CREATE TABLE ....

COPY FROM stdin ....

etc.

--=20
Med venlig hilsen / Best regards / Mit freundlichen Gr=FCssen

Andreas Hinz

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] ALTER SCHEMA problem - 08-17-2003 , 12:29 AM







Can someone comment on this?

---------------------------------------------------------------------------

Andreas Hinz wrote:
Quote:
If PostgreSQL failed to compile on your computer or you found a bug that
is likely to be specific to one platform then please fill out this form
and e-mail it to pgsql-ports (AT) postgresql (DOT) org.

To report any other bug, fill out the form below and e-mail it to
pgsql-bugs (AT) postgresql (DOT) org.

If you not only found the problem but solved it and generated a patch
then e-mail it to pgsql-patches (AT) postgresql (DOT) org instead. Please use the
command "diff -c" to generate the patch.

You may also enter a bug report at http://www.postgresql.org/ instead of
e-mail-ing this form.

================================================== =======================
=== POSTGRESQL BUG REPORT TEMPLATE
================================================== =======================
===


Your name : Andreas Hinz
Your email address : news3 (AT) acci (DOT) dk


System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium

Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.21 ELF

PostgreSQL version (example: PostgreSQL-7.3): PostgreSQL-7.4beta1

Compiler used (example: gcc 2.95.2) : gcc 3.2.3


Please enter a FULL description of your problem:
------------------------------------------------

Hi,
I am not absolutly sure this is a bug, but consider this:

I am about to create a database with 5 schemas each containing about 70
tables. Importing data via "psql <database> -f <file>.

After import I rename the schema "public" to eg. "base1", create a
new schema "public", import the next database etc.

Now the problem is I yse the datatype "serial" which creates then
constraint "default nextval('public.abc_sew'::test)".

When renaming the schema from "public" to "base1" all indexes and
seqenses are renames correct, but not the above "public." in the
constraint.


Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

createdb test
psql test
CREATE TABLE ta1 (f1 serial, f2 integer);
ALTER SCHEMA public RENAME TO base1;
\d base1.*


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------


Only by manual "ALTER TABLE ta1 ALTER f1 SET DEFAULT etc.

But doing this for 5 schemas each having 70 tables is somewhat stupud.

Even via a seperate file with all the "ALTER" is no solution as this is
an unfineshed project with frequent changes on the tables and thus
possible changes in this file.


A posibility to select a default schema with eg. "SET" on import would be
a really nice feature:

SET DEFAULT SCHEMA base1;

CREATE TABLE ....

COPY FROM stdin ....

etc.

--
Med venlig hilsen / Best regards / Mit freundlichen Gr?ssen

Andreas Hinz

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman (AT) candle (DOT) pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
  #3  
Old   
Chris M
 
Posts: n/a

Default Re: [BUGS] ALTER SCHEMA problem - 08-20-2003 , 06:11 PM



I also find something magic when using sequence.
select nextval('seq_test');
and
select nextval('"seq_test"');
both refer to the same sequence: seq_test.

If I want to use a sequence with name: SEQ_TEST,
I have to write it as:
select nextval('"SEQ_TEST"');

So single quotes '...' here not like those in WHERE clause.

And I think ORACLE's syntax is better.

"Tom Lane" <tgl (AT) sss (DOT) pgh.pa.us>
news:9363.1061099071 (AT) sss (DOT) pgh.pa.us...
Quote:
Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes:
Can someone comment on this?

This is unfixable as long as nextval() and friends depend on string
parameters to represent table references. There are suggestions in
our archives about how we might move to a more Oracle-like syntax
(ie, table.nextval), which would expose the table reference in a way
that could track renamings. But no one seems to have gotten really
excited about making it happen.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #4  
Old   
Bruno Wolff III
 
Posts: n/a

Default Re: [BUGS] ALTER SCHEMA problem - 08-20-2003 , 09:27 PM



On Tue, Aug 19, 2003 at 21:24:50 +0800,
Chris M <chris (AT) none (DOT) none> wrote:
Quote:
I also find something magic when using sequence.
select nextval('seq_test');
and
select nextval('"seq_test"');
both refer to the same sequence: seq_test.

If I want to use a sequence with name: SEQ_TEST,
I have to write it as:
select nextval('"SEQ_TEST"');

So single quotes '...' here not like those in WHERE clause.
That depends on your point of view. As far as what gets passed to the nextval
function 's work just like they do in the where clause. However the value
gets treated like the strings used to represent identifiers in SQL where
"s are used to quote identifier names.

Quote:
And I think ORACLE's syntax is better.
At some point someone will probably implement the Oracle syntax.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.