Обсуждение: restoring db from 8.1 in a 8.0 db

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

restoring db from 8.1 in a 8.0 db

От
sten govaerts
Дата:
Hello,

I have different database installations. One is a postgresql 8.0 and
one is a 8.1 installation.

I want to move the database from postgres 8.1 to the postgres 8.0
installation. When i restore the dump i created in 8.1, there are
more then 50 errors. thre seems to be a problem with the sequences. I
checked the postgresql documentation and i noticed that in 8.0 the
function nextval takes a text-type and in 8.1 a regclass-type.

How can i get a dump of the 8.1 db that works on the 8.0 install?

Here is a dump of the errors:

pg_restore: creating TABLE actuality
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1245; 1259 798837
TABLE actuality postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE actuality (
     gid integer DEFAULT nextval(('public.gid_seq'::text)::regclass)
NOT NULL,
     actualityname cha...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.actuality" does not exist
     Command was: ALTER TABLE public.actuality OWNER TO postgres;
pg_restore: creating TABLE albums
pg_restore: executing SEQUENCE SET albums_album_id_seq
pg_restore: creating TABLE altgroupname
pg_restore: executing SEQUENCE SET altgroupname_altgrp_id_seq
pg_restore: creating TABLE artists
pg_restore: executing SEQUENCE SET artists_artist_id_seq
pg_restore: creating TABLE continents
pg_restore: [archiver (db)] Error from TOC entry 1252; 1259 798855
TABLE continents postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE continents (
     gid integer DEFAULT nextval(('gid_seq'::text)::regclass) NOT NULL,
     continentname character...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.continents" does not exist
     Command was: ALTER TABLE public.continents OWNER TO postgres;
pg_restore: creating TABLE dancability
pg_restore: [archiver (db)] Error from TOC entry 1253; 1259 798858
TABLE dancability postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE dancability (
     gid integer DEFAULT nextval(('public.gid_seq'::text)::regclass)
NOT NULL,
     dancabilityname...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.dancability" does not exist
     Command was: ALTER TABLE public.dancability OWNER TO postgres;
pg_restore: creating TABLE dancestyles
pg_restore: [archiver (db)] Error from TOC entry 1254; 1259 798861
TABLE dancestyles postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE dancestyles (
     gid integer DEFAULT nextval(('gid_seq'::text)::regclass) NOT NULL,
     dancestylename charact...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.dancestyles" does not exist
     Command was: ALTER TABLE public.dancestyles OWNER TO postgres;
pg_restore: creating TABLE filmtv
pg_restore: executing SEQUENCE SET filmtv_filmtv_id_seq
pg_restore: creating TABLE generalvalue
pg_restore: [archiver (db)] Error from TOC entry 1257; 1259 798869
TABLE generalvalue postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE generalvalue (
     gid integer DEFAULT nextval(('public.gid_seq'::text)::regclass)
NOT NULL
);
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.generalvalue" does not exist
     Command was: ALTER TABLE public.generalvalue OWNER TO postgres;
pg_restore: creating TABLE genres
pg_restore: [archiver (db)] Error from TOC entry 1258; 1259 798872
TABLE genres postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE genres (
     gid integer DEFAULT nextval(('gid_seq'::text)::regclass) NOT NULL,
     genrename character varying...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.genres" does not exist
     Command was: ALTER TABLE public.genres OWNER TO postgres;
pg_restore: creating SEQUENCE gid_seq
pg_restore: executing SEQUENCE SET gid_seq
pg_restore: creating TABLE groupartist
pg_restore: creating TABLE groups
pg_restore: executing SEQUENCE SET groups_group_id_seq
pg_restore: creating TABLE loudness
pg_restore: [archiver (db)] Error from TOC entry 1263; 1259 798884
TABLE loudness postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE loudness (
     gid integer DEFAULT nextval(('public.gid_seq'::text)::regclass)
NOT NULL,
     loudnessname chara...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.loudness" does not exist
     Command was: ALTER TABLE public.loudness OWNER TO postgres;
pg_restore: creating TABLE parameters
pg_restore: executing SEQUENCE SET parameters_param_id_seq
pg_restore: creating TABLE partylevels
pg_restore: [archiver (db)] Error from TOC entry 1266; 1259 798892
TABLE partylevels postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE partylevels (
     gid integer DEFAULT nextval(('public.gid_seq'::text)::regclass)
NOT NULL,
     partylevelname ...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.partylevels" does not exist
     Command was: ALTER TABLE public.partylevels OWNER TO postgres;
pg_restore: creating TABLE popularity
pg_restore: [archiver (db)] Error from TOC entry 1267; 1259 798895
TABLE popularity postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE popularity (
     gid integer DEFAULT nextval(('public.gid_seq'::text)::regclass)
NOT NULL,
     popname characte...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.popularity" does not exist
     Command was: ALTER TABLE public.popularity OWNER TO postgres;
pg_restore: creating TABLE recordlabels
pg_restore: executing SEQUENCE SET recordlabels_recordlbl_id_seq
pg_restore: creating TABLE rhythmstyles
pg_restore: [archiver (db)] Error from TOC entry 1270; 1259 798903
TABLE rhythmstyles postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE rhythmstyles (
     gid integer DEFAULT nextval(('public.gid_seq'::text)::regclass)
NOT NULL,
     rhythmname cha...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.rhythmstyles" does not exist
     Command was: ALTER TABLE public.rhythmstyles OWNER TO postgres;
pg_restore: creating TABLE songs
pg_restore: creating VIEW searchsongs
pg_restore: [archiver (db)] Error from TOC entry 1273; 1259 798934
VIEW searchsongs postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"genres" does not exist
     Command was: CREATE VIEW searchsongs AS
     SELECT songs.song_id, songs.title, songs."year", songs.version,
songs.lyrics, songs.isrc, son...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.searchsongs" does not exist
     Command was: ALTER TABLE public.searchsongs OWNER TO postgres;
pg_restore: executing SEQUENCE SET songs_song_id_seq
pg_restore: creating TABLE songvalue
pg_restore: creating TABLE subgenres
pg_restore: [archiver (db)] Error from TOC entry 1275; 1259 798940
TABLE subgenres postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE subgenres (
     gid integer DEFAULT nextval(('gid_seq'::text)::regclass) NOT NULL,
     subgenrename character v...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.subgenres" does not exist
     Command was: ALTER TABLE public.subgenres OWNER TO postgres;
pg_restore: creating TABLE types
pg_restore: [archiver (db)] Error from TOC entry 1276; 1259 798943
TABLE types postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE types (
     gid integer DEFAULT nextval(('gid_seq'::text)::regclass) NOT NULL,
     typename character varying(5...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.types" does not exist
     Command was: ALTER TABLE public.types OWNER TO postgres;
pg_restore: creating TABLE valuedepends
pg_restore: creating TABLE values
pg_restore: [archiver (db)] Error from TOC entry 1278; 1259 798948
TABLE values postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE "values" (
     gid integer DEFAULT nextval(('public.gid_seq'::text)::regclass)
NOT NULL,
     valuename characte...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.values" does not exist
     Command was: ALTER TABLE public."values" OWNER TO postgres;
pg_restore: creating TABLE voices
pg_restore: [archiver (db)] Error from TOC entry 1279; 1259 798951
TABLE voices postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  cannot
cast type text to regclass
     Command was: CREATE TABLE voices (
     gid integer DEFAULT nextval(('public.gid_seq'::text)::regclass)
NOT NULL,
     voice character vary...
pg_restore: [archiver (db)] could not execute query: ERROR:  relation
"public.voices" does not exist
     Command was: ALTER TABLE public.voices OWNER TO postgres;

Thank you,

Sten

Re: restoring db from 8.1 in a 8.0 db

От
Tom Lane
Дата:
sten govaerts <sten.govaerts@cs.kuleuven.ac.be> writes:
> How can i get a dump of the 8.1 db that works on the 8.0 install?

In general, we do not try to promise backward compatibility of dumps.
If you want to do this you will need to hand-edit the dump file.

Why would you not want to upgrade your other machine to 8.1?

            regards, tom lane