Re: patch: option --if-exists for pg_dump - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: patch: option --if-exists for pg_dump
Date
Msg-id 20140217213711.GS6342@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: patch: option --if-exists for pg_dump  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Pavel Stehule escribió:

> 2014-02-17 18:10 GMT+01:00 Alvaro Herrera <alvherre@2ndquadrant.com>:

> > Maybe I am mistaken and the te->dropStmt already contains the IF EXISTS
> > bit for some reason; but if so I don't know why that is.  Care to
> > explain?
> 
> pg_restore is available to read plain dump produced by pg_dump --if-exists.
> It is way how IF EXISTS can infect te->dropStmt

Makes sense, I guess.

> > I also think that _getObjectDescription() becomes overworked after this
> > patch.  I wonder if we should be storing te->objIdentity so that we can
> > construct the ALTER OWNER command without going to as much trouble as
> > parsing the DROP command.  Is there a way to do that? Maybe we can ask
> > the server for the object identity, for example.  There is a new
> > function to do that in 9.3 which perhaps we can now use.
>
> do you think a pg_describe_object function?
> 
> Probably it is possible, but its significantly much more invasive change,
> you should to get objidentity, that is not trivial

I was thinking in pg_identify_object().  It can be given the values used
to construct the CatalogId of each tocEntry.

But yes, it is more invasive.

I'd guess that would be a project related to cleaning up the ALTER
OWNER.  What we have now looks like an kludge.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: patch: option --if-exists for pg_dump
Next
From: Andres Freund
Date:
Subject: Re: CREATE FOREIGN TABLE ( ... LIKE ... )