Re: pg_dump ordering problem (rc4) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_dump ordering problem (rc4)
Date
Msg-id 8272.987197691@sss.pgh.pa.us
Whole thread Raw
In response to pg_dump ordering problem (rc4)  (Pascal Scheffers <pascal@scheffers.net>)
Responses Re: pg_dump ordering problem (rc4)  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-hackers
I see the problem.  Your 7.0.3 dump contains several instances of this
pattern:

CREATE TABLE "users_alertable" ("user_id" int4,"email" character varying(100),"first_names" character
varying(100),"last_name"character varying(100),"password" character varying(30)
 
);

...

CREATE FUNCTION "user_vacations_kludge" (int4 ) RETURNS int4 AS '
beginreturn count(*)   from user_vacations v, users u  where u.user_id = $1 and v.user_id = u.user_id  and
current_timestampbetween v.start_date and v.end_date;
 
end;' LANGUAGE 'plpgsql';

...

CREATE RULE "_RETusers_alertable" AS ON SELECT TO users_alertable DO INSTEAD SELECT u.user_id, u.email, u.first_names,
u.last_name,u."password" FROM users u WHERE (((((u.on_vacation_until ISNULL) OR (u.on_vacation_until <
"timestamp"('now'::text)))AND (u.user_state = 'authorized'::"varchar")) AND ((u.email_bouncing_p ISNULL) OR
(u.email_bouncing_p= 'f'::bpchar))) AND (user_vacations_kludge(u.user_id) = 0));
 

Although this works fine, 7.1 folds the table + rule down into a single
CREATE VIEW, which comes before the CREATE FUNCTION because that's what
the OID ordering suggests will work.  Ugh.

A possible kluge answer is to make pg_dump's OID-ordering of views
depend on the OID of the view rule rather than the view relation.
I am not sure if that would break any cases that work now, however.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Mark Butler
Date:
Subject: NUMERIC type benchmarks
Next
From: Tom Lane
Date:
Subject: Re: pg_dump problem