[PATCH] Skip ALTER x SET SCHEMA if the schema didn't change

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] Skip ALTER x SET SCHEMA if the schema didn't change
Date: 2015-09-28 14:17:30
Message-ID: CABRT9RCy8kvXFSdNPQjKr9tC9CMfepTtds1A8w2PG6Sg3CbmYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi list

The attached patch changes the behavior of multiple ALTER x SET SCHEMA
commands, to skip, rather than fail, when the old and new schema is
the same.

The advantage is that it's now easier to write DDL scripts that are indempotent.

This already matches the behavior of ALTER EXTENSION SET SCHEMA in
earlier versions, as well as many other SET-ish commands, e.g. ALTER
TABLE SET TABLESPACE, OWNER TO, CLUSTER ON, SET (storage_parameter...)
etc. I don't see why SET SCHEMA should be treated any differently.

The code is written such that object_access_hook is still called for
each object.

Regression tests included. I couldn't find any documentation that
needs changing.

Regards,
Marti

Attachment Content-Type Size
0001-Skip-ALTER-x-SET-SCHEMA-if-the-schema-didn-t-change.patch binary/octet-stream 11.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-09-28 14:20:58 Re: Doubt in pgbench TPS number
Previous Message Simon Riggs 2015-09-28 14:07:02 Re: BRIN Scan: Optimize memory allocation in function 'bringetbitmap'