PostgreSQL appears to now stash the PlannedStmt somewhere within
ProcessUtility itself (per Marco), which results in a use-after-free
bug if we keep our old behavior of overriding the PlannedStmt's utility
statement with a copy with baked-in schema names.
The quickest fix is to just avoid this behavior altogether for
PostgreSQL 10. Because this area of code needs some attention anyhow
(i.e. we're not always doing the right things wrt schema name lookups
for our utility statements), Marco suggested this fix until we get to
a more comprehensive correction covering other utility commands.
For now, I'm the HyperLogLog install, since no PostgreSQL 10 package
exists yet. The add_pg10 branch of citusdata/tools is where I've made
required Travis script changes.
Many tests now need 9.5-, 9.6-, and 10-specific output files. I've
"shifted" all such files. The mapping is:
* No suffix: PostgreSQL 10
* _0 suffix: PostgreSQL 9.6, or 9.x if no _1 present
* _1 suffix: PostgreSQL 9.5
All tests output the version at the top, so it's clear which output
belongs to which version.
Sequences used to have a pretty weird representation: C code could read
their attributes by loading the single tuple stored in their relation.
Now each sequence has a corresponding tuple in pg_sequence, and there
are syscache entries for each, meaning we can (and must) use syscache
methods to look up attributes for sequences.
This is the sole PostgreSQL 10 change that "breaks" Citus; we use this
function and no alternative is available. Fortunately, it's small
enough to copy-paste.
Now requires a RawStmt rather than any old Node. Methods to parse DDL
into a list of Nodes now return a list of RawStmts; the old Nodes we
expect are available as one of their fields. ParseTreeRawStmt is used
in PostgreSQL 10 to obtain the RawStmt itself; the behavior of the old
ParseTreeNode is preserved and it always returns a simple Node.
getOwnedSequences can now filter owned sequences by a specified column.
Passing InvalidAttrNumber preserves the original behavior of returning
all sequences owned by a specified relation.
PostgreSQL 10 removes the ability to directly call CatalogUpdateIndexes
in favor of new CatalogTupleUpdate and CatalogTupleInsert calls, which
do this for us.
Certain PostgreSQL 10 changes require modifications to our includes:
* pg_sequence's interace has been refactored into its own file
* textToQualifiedNameList is now in utils/varlena.h
* pg_getnameinfo_all is now in common/ip.h
* stringToQualifiedNameList is now in utils/regproc.h
WaitLatchOrSocket now accepts a "wait_event_info" argument for use by
pg_stat. Extensions appear to mostly just pass "PG_WAIT_EXTENSION", so
that's what I've done.
PostgreSQL 10's ProcessUtility now requires a PlannedStmt with its
utilityStmt field set to what we used to pass directly.
In addition, it receives a QueryEnvironment reference, altogether new
but apparently OK to NULL out for now.
This adds a wrapper to adapt to the new style and fixes all callers.
- Use native postgres function for composite key btree functions
- Move explain tests to multi_explain.sql (get rid of .out _0.out files)
- Get rid of input/output files for multi_subquery.sql by moving table creations
- Update some comments
With this commit we start to register InvalidateDistRelationCacheCallback
function as cache invalidation callback function before version checks
because during version checks we use cache to look up relation ids of some
relations like pg_dist_relation or pg_dist_partition_logical_relid_index
and we want to know about cache invalidation before accessing them.
During version update, we indirectly calld CheckInstalledVersion via
ChackCitusVersions. This obviously fails because during version update it is
expected to have version mismatch between installed version and binary version.
Thus, we remove that ChackCitusVersions. We now only call ChackAvailableVersion.