From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | some pg_dump query code simplification |
Date: | 2018-08-28 21:12:43 |
Message-ID: | bb58198d-ad00-67cc-20da-6675739bebcc@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
There is a lot of version dependent code in pg_dump now, especially
per-version queries. The way they were originally built was that we
just have an entirely separate query per version. But as the number of
versions and the size of the query grows, this becomes unwieldy.
So I tried, as an example, to write the queries in getTableAttrs()
differently. Instead of repeating the almost same large query in each
version branch, use one query and add a few columns to the SELECT list
depending on the version. This saves a lot of duplication and is easier
to deal with. I think this patch is useful in its own right, but there
is also the larger question of whether people think this is a better
style going forward, for pg_dump and psql. (It's already in use in psql
in some places.) It won't always work, if the query structure is very
different between versions, but as this example shows, it can be useful.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
0001-pg_dump-Reorganize-getTableAttrs.patch | text/plain | 10.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David Steele | 2018-08-28 21:15:54 | Re: Would it be possible to have parallel archiving? |
Previous Message | Andrey Borodin | 2018-08-28 21:04:23 | Re: Would it be possible to have parallel archiving? |