some pg_dump query code simplification - Mailing list pgsql-hackers

From Peter Eisentraut
Subject some pg_dump query code simplification
Date
Msg-id bb58198d-ad00-67cc-20da-6675739bebcc@2ndquadrant.com
Whole thread Raw
Responses Re: some pg_dump query code simplification
List 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

pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: Would it be possible to have parallel archiving?
Next
From: David Steele
Date:
Subject: Re: Would it be possible to have parallel archiving?