| From: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
|---|---|
| To: | Miles Elam <miles(dot)elam(at)productops(dot)com> |
| Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Idempotent DDL Updates |
| Date: | 2021-08-28 02:14:33 |
| Message-ID: | CAOBaU_ahhqLJAHk-GWu_zsx3m+vEWb6gbHt_7Stte8NdUTeCtg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Sat, Aug 28, 2021 at 2:19 AM Miles Elam <miles(dot)elam(at)productops(dot)com> wrote:
>
> What is the general consensus within the community on idempotent DDL scripts, ie. consistent usage of IF EXISTS/IF NOT EXISTS/OR REPLACE for SQL init files that get checked into source control?
> [...]
> The drawbacks I've run across are those areas where the EXISTS/REPLACE constructs aren't implemented like roles management, domains, constraints, etc. However those cases seem to be handled with only minor increases in complexity with judicious use of inline plpgsql.
>
> In others' opinions, has DDL idempotency been viable for maintenance of PG databases fo you in production?
Note that the IF EXISTS / IF NOT EXISTS are *not* idempotent. If you
need to write idempotent schema update scripts, you need to query the
catalogs to check if the specific change you want to apply has already
been applied or not.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | hubert depesz lubaczewski | 2021-08-28 06:38:24 | Re: Can we get rid of repeated queries from pg_dump? |
| Previous Message | obi reddy | 2021-08-28 01:17:22 | Re: |