13 Commits

Author SHA1 Message Date
Nikhil Sontakke
b2773aa344 Fix crash in COPY from program returning error
Reset the errcallback appropriately so that the ereport in case
of a PROGRAM returning error can work correctly.
2023-08-02 12:41:19 +05:30
Lakshmi Narayanan Sreethar
c3a9f90fdd Merge PG12 specific testfiles
Merged testfiles that were split out due to their output differing only
in PG12.
2023-07-25 16:00:18 +05:30
Sven Klemm
9d0f38b12f Make copy test output PG version specific
PG13 changes the error message on constraint validation to include
the relation making the error message different from previous
PG versions.
2021-01-29 21:45:48 +01:00
Sven Klemm
663463771b Use EXECUTE FUNCTION instead of EXECUTE PROCEDURE
Replace EXECUTE PROCEDURE with EXECUTE FUNCTION because the former
is deprecated in PG11+. Unfortunately some test output will still
have EXECUTE PROCEDURE because pg_get_triggerdef in PG11 still
generates a definition with EXECUTE PROCEDURE.
2020-06-02 17:33:05 +02:00
Mats Kindahl
7d78540a22 Fix segfault on COPY to hypertable
When copying from standard input the range table was not set up to
handle the constraints for the target table and instead is initialized
to null. In addition, the range table index was set to zero, causing an
underflow when executing the constraint check. This commit fixes this
by initializing the range table and setting the index correctly.

The code worked correctly for PG12, so the code is also refactored to
ensure that the range table and index is set the same way in all
versions.

Fixes #1840
2020-04-27 08:49:24 +02:00
Brian Rowe
09616da90e Add support for PG12 COPY WHERE statements
PG12 allows users to add a WHERE clause when copying from from a
file into a table.  This change adds support for such clauses on
hypertables.  Also fixes a issue that would have arisen in cases
where a table being copied into had a trigger that caused a row to
be skipped.
2020-04-14 23:12:15 +02:00
Mats Kindahl
38654b2158 Print notice for COPY TO on hypertable
When using `COPY TO` on a hypertable (which copies from the hypertable
to some other destination), nothing will be printed and nothing will be
copied. Since this can be potentially confusing for users, this commit
print a notice when an attempt is made to copy from a hypertable
directly (not using a query) to some other destination.
2020-01-16 13:19:08 +01:00
Sven Klemm
f63bf57dad Add missing ORDER BY to test query
Some of the ORDER BY clauses did not produce a unique order.
This patch fixes those queries to make the test results consistent.
2019-05-20 15:10:37 +02:00
Sven Klemm
f89fd07c5b Remove year from SQL file license text
This changes the license text for SQL files to be identical
with the license text for C files.
2019-01-13 23:30:22 +01:00
Joshua Lockerman
4b42b301a7 Free ChunkInsertStates when the es_per_tuple_exprcontext is freed
Instead of freeing ChunkInsertStates immediately when flushed from the
SubspaceStore, defer the freeing until the es_per_tuple_exprcontext is
being cleaned up. This ensures that pointers into the CIS don't become
invalidated without us freeing any of postgres's memory, like we were
doing in the prior fix; this fixes a segfault in COPY.

In the normal INSERT case these frees happen at approximately the same
time so there should be no regression in memory usage, while if there
was a delay in freeing the es_per_tuple_exprcontext our old strategy of
clearing the context ourselves was invalid.
2018-12-14 16:08:40 -05:00
Joshua Lockerman
20ec6914c0 Add license headers to SQL files and test code 2018-10-29 13:28:19 -04:00
Erik Nordström
b037e06db0 Fix copy test sort order
A change to the COPY test made the sort order ambiguous
for certain tuples, which breaks the test on some machines
where the sort order might differ from the expected one.

This fix makes the sort order more predictible.
2017-12-18 12:16:23 -05:00
Matvey Arye
438d79d1ed Fix trigger relcache handling for COPY
Previously trigger relcache entries were not always freed during
COPY commands in PG10. This PR fixes that.

Fixes #351.
2017-12-14 13:53:37 -05:00