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

From Pavel Stehule
Subject Re: patch: option --if-exists for pg_dump
Date
Msg-id CAFj8pRBA8rs8ZvyLN=vgdxQJXY3Rk+6VUms+t99+zG9oK=pLYQ@mail.gmail.com
Whole thread Raw
In response to Re: patch: option --if-exists for pg_dump  (Jeevan Chalke <jeevan.chalke@enterprisedb.com>)
Responses Re: patch: option --if-exists for pg_dump
List pgsql-hackers



2014-01-29 Jeevan Chalke <jeevan.chalke@enterprisedb.com>
Hi Pavel,

Now the patch looks good to me. However when I try to restore your own sql file's dump, I get following errors:

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "public.emp" does not exist
    Command was: DROP TRIGGER IF EXISTS emp_insert_trigger ON public.emp;

pg_restore: [archiver (db)] could not execute query: ERROR:  schema "myschema" does not exist
    Command was: DROP FUNCTION IF EXISTS myschema.int_to_date(integer);

Is that expected after your patch ?

 

Also, I didn't quite understand these lines of comments:

                        /*
                         * Descriptor string (te-desc) should not be same as object
                         * specifier for DROP STATEMENT. The DROP DEFAULT has not
                         * IF EXISTS clause - has not sense.
                         */

Will you please rephrase ?

I can try it - .

A content of te->desc is usually substring of DROP STATEMENT with one related exception - CONSTRAINT.
Independent to previous sentence - ALTER TABLE ALTER COLUMN DROP DEFAULT doesn't support IF EXISTS - and therefore it should not be injected.

Regards

Pavel
 

Thanks
--
Jeevan B Chalke
Principal Software Engineer, Product Development
EnterpriseDB Corporation
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Jeevan Chalke
Date:
Subject: Re: patch: option --if-exists for pg_dump
Next
From: Simon Riggs
Date:
Subject: Re: WIP patch (v2) for updatable security barrier views