BUG #2557: field`s default value not restored in big sql script

Started by Borisover 19 years ago2 messagesbugs
Jump to latest
#1Boris
boris_k@iname.com

The following bug has been logged online:

Bug reference: 2557
Logged by: Boris
Email address: boris_k@iname.com
PostgreSQL version: 8.1.4
Operating system: win 2000, freebsd
Description: field`s default value not restored in big sql script
Details:

Hi!
This sql script was created by pd_dump.
(http://www.lanukr.com/upload/errordump.zip)
No error when i run this script to restore DB.
But table "auth"."access_flag" has wrong def value for "access_flag_id".
I think ii must be
nextval('auth.access_flag_access_flag_id_seq'::regclass).

From script it becomes nextval('access_flag_access_flag_id_seq'::regclass)

When I run a shot script to create this table - no problem. deff value is
correct for field "access_flag_id"

CREATE TABLE "auth"."access_flag_2" (
"access_flag_id" SERIAL,
"access_flag_name" TEXT NOT NULL,
"comments" TEXT,
"long_flag_name" TEXT,
CONSTRAINT "access_flag_2_access_flag_name_key"
UNIQUE("access_flag_name"),
CONSTRAINT "access_flag_2_pkey" PRIMARY KEY("access_flag_id")
)

HOW TO:
1. Create db test
2. restore db from script by
psql -d test -U your_user_name -f dump.sql >123.log 2<&1

3. check if table "auth"."access_flag" has a field "access_flag_id" as PK
and has deff value nextval('access_flag_access_flag_id_seq'::regclass) (
error)

I can reproduse this error on "PostgreSQL 8.1.4 on i386-portbld-freebsd4.9,
compiled by GCC 2.95.4" too.

any info you need upon req.
ICQ 176869864
Boris

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Boris (#1)
Re: BUG #2557: field`s default value not restored in big sql script

"Boris" <boris_k@iname.com> writes:

But table "auth"."access_flag" has wrong def value for "access_flag_id".
I think ii must be
nextval('auth.access_flag_access_flag_id_seq'::regclass).

From script it becomes nextval('access_flag_access_flag_id_seq'::regclass)

This is not wrong, or at least you haven't provided enough info to prove
that it is wrong. The display of a regclass constant is schema-aware.
Try doing \d on the table with search_path set to something that doesn't
include the auth schema ... does it show as auth.something then?

regards, tom lane