Re: patch: option --if-exists for pg_dump

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>
Subject: Re: patch: option --if-exists for pg_dump
Date: 2014-01-29 17:20:02
Message-ID: CAFj8pRDA7JYQwcGWb6tH3L2VriV183bD-k1oqHaP0fsSbFOGUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2014-01-29 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>

>
>
>
> 2014-01-29 Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)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 ?
>>
>
> it should be fixed by
> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=b152c6cd0de1827ba58756e24e18110cf902182acommit
>
>
>>
>> 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.
>

is it ok?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-01-29 18:03:16 Re: jsonb and nested hstore
Previous Message Steeve Lennmark 2014-01-29 17:07:06 Re: [PATCH] Relocation of tablespaces in pg_basebackup