7 Commits

Author SHA1 Message Date
Sven Klemm
0f70ae87bf Fix flaky truncate test
Change truncate test to ignore warnings about potentially orphaned
files when dropping the test database. This seems to happen quite
frequently on appveyor causing the test to be flaky.
2022-04-19 05:16:15 +02:00
Konstantina Skovola
731a39a122 Fix TRUNCATE error as non-owner on hypertable
Stop throwing error "must be owner of hypertable" when a user with
TRUNCATE privilege on the hypertable attempts to TRUNCATE.

Previously we had a check that required TRUNCATE to only be
performed by the table owner, not taking into account the user's
TRUNCATE privilege, which is sufficient to allow this operation.

Fixes #4183
2022-04-11 14:22:14 +03:00
Fabrízio de Royes Mello
74ca546565 Fix memory context bug executing TRUNCATE
Inside the `process_truncate` function is created a new relations list
removing the distributed hypertables and this new list is assigned to
the current statement relation list. This new list is allocated into
the `PortalContext` that is destroyed at the end of the statement
execution.

The problem arise on the subsequent `TRUNCATE` call because the
compiled plpgsql code is cached into another memory context and the
elements of the relations inside this cache is pointing to an invalid
memory area because the `PortalContext` is destroyed.

Fixed it by allocating the new relations list to the same memory
context of the original list.

Fixes #3580, fixes #3622, fixes #3182
2021-10-06 16:13:21 -03: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
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
20ec6914c0 Add license headers to SQL files and test code 2018-10-29 13:28:19 -04:00
Erik Nordström
6adce4cbd8 Handle TRUNCATE without upcall and handle ONLY modifier
This change refactors the handling of TRUNCATE so
that it is performed directly in process utility without
doing an upcall to PL/pgSQL.

It also adds handling for the ONLY modifier to TRUNCATE,
which shouldn't work on a hypertable. TRUNCATE now generates
an error if TRUNCATE ONLY is used on a hypertable.
2018-02-01 10:12:48 +01:00