mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-14 09:37:00 +08:00
parent
736c20fb71
commit
8cccc375fb
@ -8,6 +8,7 @@ include(GitCommands)
|
||||
include(GenerateScripts)
|
||||
include(CMakeDependentOption)
|
||||
|
||||
option(APACHE_ONLY "only compile apache code" off)
|
||||
# This requires all tests to run. This defaults to OFF but can be enabled to
|
||||
# ensure that no tests are skipped because of missing tools.
|
||||
option(REQUIRE_ALL_TESTS "Require all tests to run." OFF)
|
||||
@ -386,6 +387,12 @@ set(EXT_CONTROL_FILE ${PROJECT_NAME}.control)
|
||||
if(${PG_VERSION_MAJOR} GREATER "12")
|
||||
set(TRUSTED trusted=true)
|
||||
endif()
|
||||
|
||||
if(APACHE_ONLY)
|
||||
set(LICENSE_EDITION "Apache 2 Edition")
|
||||
else()
|
||||
set(LICENSE_EDITION "Community Edition")
|
||||
endif()
|
||||
configure_file(${EXT_CONTROL_FILE}.in ${EXT_CONTROL_FILE})
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXT_CONTROL_FILE}
|
||||
@ -618,8 +625,6 @@ add_subdirectory(sql)
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(src)
|
||||
|
||||
option(APACHE_ONLY "only compile apache code" off)
|
||||
|
||||
if(NOT APACHE_ONLY)
|
||||
add_subdirectory(tsl)
|
||||
endif()
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
\set TEST_DBNAME_2 :TEST_DBNAME _2
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
CREATE DATABASE :TEST_DBNAME_2;
|
||||
CREATE DATABASE :"TEST_DBNAME_2";
|
||||
DROP EXTENSION timescaledb;
|
||||
--no extension
|
||||
\dx
|
||||
@ -31,11 +31,11 @@ WARNING: mock post_analyze_hook "mock-1"
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb VERSION 'mock-1';
|
||||
@ -78,11 +78,11 @@ WARNING: mock post_analyze_hook "mock-1"
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
--start new backend;
|
||||
@ -113,11 +113,11 @@ WARNING: mock function call "mock-1"
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER
|
||||
@ -219,11 +219,11 @@ CREATE EXTENSION timescaledb VERSION 'mock-1';
|
||||
WARNING: mock init "mock-1"
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
--start a new backend to update
|
||||
@ -239,11 +239,11 @@ WARNING: mock post_analyze_hook "mock-2"
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
--drop extension
|
||||
@ -274,11 +274,11 @@ WARNING: mock post_analyze_hook "mock-2"
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
-- test db 1 still has old version
|
||||
@ -293,11 +293,11 @@ WARNING: mock post_analyze_hook "mock-1"
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
--try a broken upgrade
|
||||
@ -305,11 +305,11 @@ WARNING: mock post_analyze_hook "mock-1"
|
||||
\dx
|
||||
WARNING: mock init "mock-2"
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
\set ON_ERROR_STOP 0
|
||||
@ -326,11 +326,11 @@ WARNING: mock post_analyze_hook "mock-2"
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
--drop extension
|
||||
@ -362,11 +362,11 @@ WARNING: mock post_analyze_hook "mock-3"
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-3"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-3 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-3 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
DROP EXTENSION timescaledb;
|
||||
@ -476,11 +476,11 @@ server closed the connection unexpectedly
|
||||
connection to server was lost
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-6"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-6 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-6 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
--TEST: create extension when old .so already loaded
|
||||
@ -489,11 +489,11 @@ WARNING: mock post_analyze_hook "mock-6"
|
||||
\dx
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
DROP EXTENSION timescaledb;
|
||||
@ -522,11 +522,11 @@ CREATE EXTENSION timescaledb VERSION 'mock-2';
|
||||
WARNING: mock init "mock-2"
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+-------------------------------------------------------------------
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+--------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)
|
||||
(2 rows)
|
||||
|
||||
--make sure parallel workers started after a 'DISCARD ALL' work
|
||||
@ -550,6 +550,6 @@ WARNING: mock init "mock-2"
|
||||
|
||||
-- clean up additional database
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
DROP DATABASE :TEST_DBNAME_2;
|
||||
DROP DATABASE :"TEST_DBNAME_2";
|
||||
WARNING: mock init "mock-2"
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
555
test/expected/loader-tsl.out
Normal file
555
test/expected/loader-tsl.out
Normal file
@ -0,0 +1,555 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
\set TEST_DBNAME_2 :TEST_DBNAME _2
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
CREATE DATABASE :"TEST_DBNAME_2";
|
||||
DROP EXTENSION timescaledb;
|
||||
--no extension
|
||||
\dx
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
---------+---------+------------+------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
(1 row)
|
||||
|
||||
SELECT 1;
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
CREATE EXTENSION timescaledb VERSION 'mock-1';
|
||||
WARNING: mock init "mock-1"
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb VERSION 'mock-1';
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
NOTICE: extension "timescaledb" already exists, skipping
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb VERSION 'mock-2';
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
NOTICE: extension "timescaledb" already exists, skipping
|
||||
DROP EXTENSION timescaledb;
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
\set ON_ERROR_STOP 0
|
||||
--test that we cannot accidentally load another library version
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb VERSION 'mock-2';
|
||||
ERROR: extension "timescaledb" has already been loaded with another version
|
||||
\set ON_ERROR_STOP 1
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
--no extension
|
||||
\dx
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
---------+---------+------------+------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
(1 row)
|
||||
|
||||
SELECT 1;
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
CREATE EXTENSION timescaledb VERSION 'mock-1';
|
||||
WARNING: mock init "mock-1"
|
||||
--same backend as create extension;
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
--start new backend;
|
||||
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER
|
||||
SELECT 1;
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
--test fn call after load
|
||||
SELECT mock_function();
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
WARNING: mock function call "mock-1"
|
||||
mock_function
|
||||
---------------
|
||||
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER
|
||||
--test fn call as first command
|
||||
SELECT mock_function();
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
WARNING: mock function call "mock-1"
|
||||
mock_function
|
||||
---------------
|
||||
|
||||
(1 row)
|
||||
|
||||
--use guc to prevent loading
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
SET timescaledb.disable_load = 'on';
|
||||
SELECT 1;
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
SELECT 1;
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
SET timescaledb.disable_load = 'off';
|
||||
SELECT 1;
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\set ON_ERROR_STOP 0
|
||||
SET timescaledb.disable_load = 'not bool';
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
ERROR: parameter "timescaledb.disable_load" requires a Boolean value
|
||||
\set ON_ERROR_STOP 1
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
RESET ALL;
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
SET timescaledb.disable_load TO DEFAULT;
|
||||
SELECT 1;
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
RESET timescaledb.disable_load;
|
||||
SELECT 1;
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
SET timescaledb.other = 'on';
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\set ON_ERROR_STOP 0
|
||||
--cannot update extension after .so of previous version already loaded
|
||||
ALTER EXTENSION timescaledb UPDATE TO 'mock-2';
|
||||
ERROR: extension "timescaledb" cannot be updated after the old version has already been loaded
|
||||
\set ON_ERROR_STOP 1
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
\dx
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
---------+---------+------------+------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
(1 row)
|
||||
|
||||
CREATE EXTENSION timescaledb VERSION 'mock-1';
|
||||
WARNING: mock init "mock-1"
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
--start a new backend to update
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
ALTER EXTENSION timescaledb UPDATE TO 'mock-2';
|
||||
WARNING: mock init "mock-2"
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
--drop extension
|
||||
DROP EXTENSION timescaledb;
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
SELECT 1;
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
---------+---------+------------+------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
(1 row)
|
||||
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
CREATE EXTENSION timescaledb VERSION 'mock-2';
|
||||
WARNING: mock init "mock-2"
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
-- test db 1 still has old version
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
SELECT 1;
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
--try a broken upgrade
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
\dx
|
||||
WARNING: mock init "mock-2"
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
\set ON_ERROR_STOP 0
|
||||
ALTER EXTENSION timescaledb UPDATE TO 'mock-3';
|
||||
ERROR: extension "timescaledb" cannot be updated after the old version has already been loaded
|
||||
\set ON_ERROR_STOP 1
|
||||
--should still be on mock-2
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
--drop extension
|
||||
DROP EXTENSION timescaledb;
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
SELECT 1;
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
---------+---------+------------+------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
(1 row)
|
||||
|
||||
--create extension anew, only upgrade was broken
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
CREATE EXTENSION timescaledb VERSION 'mock-3';
|
||||
WARNING: mock init "mock-3"
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-3"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-3"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-3 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
DROP EXTENSION timescaledb;
|
||||
WARNING: mock post_analyze_hook "mock-3"
|
||||
SELECT 1;
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
--mismatched version errors
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
--mock-4 has mismatched versions, so the .so load should be fatal
|
||||
SELECT format($$\! utils/test_fatal_command.sh %1$s "CREATE EXTENSION timescaledb VERSION 'mock-4'"$$, :'TEST_DBNAME_2') as command_to_run \gset
|
||||
:command_to_run
|
||||
FATAL: extension "timescaledb" version mismatch: shared library version mock-4-mismatch; SQL version mock-4
|
||||
server closed the connection unexpectedly
|
||||
This probably means the server terminated abnormally
|
||||
before or while processing the request.
|
||||
connection to server was lost
|
||||
--mock-4 not installed.
|
||||
\dx
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
---------+---------+------------+------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
(1 row)
|
||||
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
--broken version and drop
|
||||
CREATE EXTENSION timescaledb VERSION 'mock-broken';
|
||||
WARNING: mock init "mock-broken"
|
||||
\set ON_ERROR_STOP 0
|
||||
--intentional broken version
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-broken"
|
||||
ERROR: mock broken "mock-broken"
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-broken"
|
||||
ERROR: mock broken "mock-broken"
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-broken"
|
||||
ERROR: mock broken "mock-broken"
|
||||
--cannot drop extension; already loaded broken version
|
||||
DROP EXTENSION timescaledb;
|
||||
WARNING: mock post_analyze_hook "mock-broken"
|
||||
ERROR: mock broken "mock-broken"
|
||||
\set ON_ERROR_STOP 1
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
--can drop extension now. Since drop first command.
|
||||
DROP EXTENSION timescaledb;
|
||||
\dx
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
---------+---------+------------+------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
(1 row)
|
||||
|
||||
--broken version and update to fixed
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
CREATE EXTENSION timescaledb VERSION 'mock-broken';
|
||||
WARNING: mock init "mock-broken"
|
||||
\set ON_ERROR_STOP 0
|
||||
--intentional broken version
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-broken"
|
||||
ERROR: mock broken "mock-broken"
|
||||
--cannot update extension; already loaded bad version
|
||||
ALTER EXTENSION timescaledb UPDATE TO 'mock-5';
|
||||
ERROR: extension "timescaledb" cannot be updated after the old version has already been loaded
|
||||
\set ON_ERROR_STOP 1
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
--can update extension now.
|
||||
ALTER EXTENSION timescaledb UPDATE TO 'mock-5';
|
||||
WARNING: mock init "mock-5"
|
||||
SELECT 1;
|
||||
WARNING: mock post_analyze_hook "mock-5"
|
||||
?column?
|
||||
----------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
SELECT mock_function();
|
||||
WARNING: mock post_analyze_hook "mock-5"
|
||||
WARNING: mock function call "mock-5"
|
||||
mock_function
|
||||
---------------
|
||||
|
||||
(1 row)
|
||||
|
||||
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
|
||||
ALTER EXTENSION timescaledb UPDATE TO 'mock-6';
|
||||
WARNING: mock init "mock-6"
|
||||
--The mock-5->mock_6 upgrade is intentionally broken.
|
||||
--The mock_function was never changed to point to mock-6 in the update script.
|
||||
--Thus mock_function is defined incorrectly to point to the mock-5.so
|
||||
--This will now be a FATAL error.
|
||||
SELECT format($$\! utils/test_fatal_command.sh %1$s "SELECT mock_function()"$$, :'TEST_DBNAME_2') as command_to_run \gset
|
||||
WARNING: mock post_analyze_hook "mock-6"
|
||||
:command_to_run
|
||||
WARNING: mock init "mock-6"
|
||||
WARNING: mock post_analyze_hook "mock-6"
|
||||
FATAL: extension "timescaledb" version mismatch: shared library version mock-5; SQL version mock-6
|
||||
server closed the connection unexpectedly
|
||||
This probably means the server terminated abnormally
|
||||
before or while processing the request.
|
||||
connection to server was lost
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-6"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-6 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
--TEST: create extension when old .so already loaded
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
--force load of extension with (\dx)
|
||||
\dx
|
||||
WARNING: mock init "mock-1"
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-1 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
DROP EXTENSION timescaledb;
|
||||
WARNING: mock post_analyze_hook "mock-1"
|
||||
\dx
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
---------+---------+------------+------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
(1 row)
|
||||
|
||||
\set ON_ERROR_STOP 0
|
||||
CREATE EXTENSION timescaledb VERSION 'mock-2';
|
||||
ERROR: extension "timescaledb" has already been loaded with another version
|
||||
\set ON_ERROR_STOP 1
|
||||
\dx
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
---------+---------+------------+------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
(1 row)
|
||||
|
||||
--can create in a new session.
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
CREATE EXTENSION timescaledb VERSION 'mock-2';
|
||||
WARNING: mock init "mock-2"
|
||||
\dx
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
List of installed extensions
|
||||
Name | Version | Schema | Description
|
||||
-------------+---------+------------+---------------------------------------------------------------------------------------
|
||||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
|
||||
timescaledb | mock-2 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
|
||||
(2 rows)
|
||||
|
||||
--make sure parallel workers started after a 'DISCARD ALL' work
|
||||
CREATE TABLE test (i int, j double precision);
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
INSERT INTO test SELECT x, x+0.1 FROM generate_series(1,100) AS x;
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
DISCARD ALL;
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
SET force_parallel_mode = 'on';
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
SET max_parallel_workers_per_gather = 1;
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
SELECT count(*) FROM test;
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
||||
WARNING: mock init "mock-2"
|
||||
count
|
||||
-------
|
||||
100
|
||||
(1 row)
|
||||
|
||||
-- clean up additional database
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
DROP DATABASE :"TEST_DBNAME_2";
|
||||
WARNING: mock init "mock-2"
|
||||
WARNING: mock post_analyze_hook "mock-2"
|
@ -72,6 +72,12 @@ set(TEST_TEMPLATES
|
||||
parallel.sql.in
|
||||
query.sql.in)
|
||||
|
||||
# Loader test must distinguish between Apache and TSL builds so we parametrize
|
||||
# this here
|
||||
set(LOADER_TEST_FILE loader-${TEST_LICENSE_SUFFIX})
|
||||
configure_file(loader.sql.in
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${LOADER_TEST_FILE}.sql)
|
||||
|
||||
# tests that fail or are unreliable when run in parallel bgw tests need to run
|
||||
# first otherwise they are flaky
|
||||
set(SOLO_TESTS
|
||||
@ -80,12 +86,13 @@ set(SOLO_TESTS
|
||||
bgw_launcher
|
||||
chunk_utils
|
||||
index
|
||||
loader
|
||||
net
|
||||
pg_dump_unprivileged
|
||||
tablespace
|
||||
telemetry)
|
||||
|
||||
list(APPEND SOLO_TESTS ${LOADER_TEST_FILE})
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
list(
|
||||
APPEND
|
||||
@ -94,13 +101,13 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
c_unit_tests.sql
|
||||
copy_memory_usage.sql
|
||||
guc_options.sql
|
||||
loader.sql
|
||||
metadata.sql
|
||||
multi_transaction_index.sql
|
||||
net.sql
|
||||
pg_dump.sql
|
||||
symbol_conflict.sql
|
||||
test_utils.sql)
|
||||
test_utils.sql
|
||||
${LOADER_TEST_FILE}.sql)
|
||||
if(USE_TELEMETRY)
|
||||
list(APPEND TEST_FILES telemetry.sql)
|
||||
endif()
|
||||
|
@ -5,7 +5,8 @@
|
||||
\set TEST_DBNAME_2 :TEST_DBNAME _2
|
||||
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
CREATE DATABASE :TEST_DBNAME_2;
|
||||
|
||||
CREATE DATABASE :"TEST_DBNAME_2";
|
||||
|
||||
DROP EXTENSION timescaledb;
|
||||
--no extension
|
||||
@ -209,5 +210,4 @@ SELECT count(*) FROM test;
|
||||
|
||||
-- clean up additional database
|
||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||
DROP DATABASE :TEST_DBNAME_2;
|
||||
|
||||
DROP DATABASE :"TEST_DBNAME_2";
|
@ -152,3 +152,8 @@ if(PG_ISOLATION_REGRESS)
|
||||
endif()
|
||||
|
||||
set(TEST_VERSION_SUFFIX ${PG_VERSION_MAJOR})
|
||||
if(APACHE_ONLY)
|
||||
set(TEST_LICENSE_SUFFIX "oss")
|
||||
else()
|
||||
set(TEST_LICENSE_SUFFIX "tsl")
|
||||
endif()
|
||||
|
@ -1,5 +1,5 @@
|
||||
# timescaledb extension
|
||||
comment = 'Enables scalable inserts and complex queries for time-series data'
|
||||
comment = 'Enables scalable inserts and complex queries for time-series data (@LICENSE_EDITION@)'
|
||||
default_version = '@PROJECT_VERSION_MOD@'
|
||||
module_pathname = '$libdir/timescaledb-@PROJECT_VERSION_MOD@'
|
||||
#extension cannot be relocatable once installed because it uses multiple schemas and that is forbidden by PG.
|
||||
|
Loading…
x
Reference in New Issue
Block a user