Обсуждение: BUG #2274: Error in 'CREATE DOMAIN' SQL command in dump file
The following bug has been logged online:
Bug reference: 2274
Logged by: Alexander Galler
Email address: galler@kuzbass.net
PostgreSQL version: 8.1.3
Operating system: Windows XP
Description: Error in 'CREATE DOMAIN' SQL command in dump file
Details:
I have created domain 'address_period_tsi':
SET search_path = public, pg_catalog;
CREATE TYPE tsinterval
(
INPUT=tsinterval_in,
OUTPUT=tsinterval_out,
DEFAULT='',
INTERNALLENGTH=32,
ALIGNMENT=int4,
STORAGE=PLAIN
);
SET search_path = kladr, pg_catalog;
CREATE DOMAIN address_period_tsi
AS public.tsinterval
NOT NULL
DEFAULT '(-infinity..infinity)';
I have create and load dump file 'test.dump':
pg_dump -U postgres test >test.dump
psql -U postgres -f test.dump -d test
psql:test.dump:415: ERROR: type "tsinterval" does not exist
In dump file:
CREATE DOMAIN address_period_tsi
AS public.tsinterval
NOT NULL
DEFAULT '(-infinity..infinity)'::tsinterval;
Some result if i have create domain:
CREATE DOMAIN address_period_tsi
AS public.tsinterval
NOT NULL
DEFAULT '(-infinity..infinity)'::tsinterval;
OR:
CREATE DOMAIN address_period_tsi
AS public.tsinterval
NOT NULL
DEFAULT '(-infinity..infinity)'::public.tsinterval;
"Alexander Galler" <galler@kuzbass.net> writes:
> psql:test.dump:415: ERROR: type "tsinterval" does not exist
> In dump file:
> CREATE DOMAIN address_period_tsi
> AS public.tsinterval
> NOT NULL
> DEFAULT '(-infinity..infinity)'::tsinterval;
I can't duplicate this --- for me, pg_dump produces
CREATE DOMAIN address_period_tsi AS public.tsinterval NOT NULL DEFAULT '(-infinity..infinity)'::public.tsinterval;
which reloads just fine. Could you provide a more complete example?
regards, tom lane
Alexander Galler <galler@kuzbass.net> writes:
>>> psql:test.dump:415: ERROR: type "tsinterval" does not exist
>>
>> I can't duplicate this --- for me, pg_dump produces
>>
>> CREATE DOMAIN address_period_tsi AS public.tsinterval NOT NULL DEFAULT '(-infinity..infinity)'::public.tsinterval;
>>
>> which reloads just fine. Could you provide a more complete example?
> I create database domain_test and use script domain_test.sql. (My
> database template include seg, ltree, tsearch2, pgstattuple).
Thanks for the test case. The reason I missed it is that the bug turns
out to depend on the schema path at the time you create the domain, not
only on what pg_dump does. (It's effectively dumping the default
according to the creation-time search path, rather than the one that
pg_dump wants to use.) I've committed a fix for 8.1.4. In the meantime
you can work around it by setting the search path the way pg_dump wants
at the time you create the domain, ie,
set search_path = my_schema, pg_catalog;
create domain ... default 'foo'::public.ltree;
regards, tom lane