-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vik Fearing
committed
May 27, 2020
1 parent
8ff348d
commit 106e8fa
Showing
6 changed files
with
137 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,28 @@ | ||
dist: bionic | ||
|
||
sudo: required | ||
|
||
language: c | ||
|
||
compiler: | ||
- gcc | ||
|
||
# run the testsuite on travis-ci.com | ||
--- | ||
# versions to run on | ||
env: | ||
matrix: | ||
- PG=12 COMPONENT=12 | ||
- PG=11 | ||
- PG=10 | ||
- PG=9.6 | ||
- PG=9.5 | ||
- PG_SUPPORTED_VERSIONS=9.5 | ||
- PG_SUPPORTED_VERSIONS=9.6 | ||
- PG_SUPPORTED_VERSIONS=10 | ||
- PG_SUPPORTED_VERSIONS=11 | ||
- PG_SUPPORTED_VERSIONS=12 | ||
- PG_SUPPORTED_VERSIONS=13 | ||
|
||
language: C | ||
dist: bionic | ||
|
||
before_install: | ||
- sudo /etc/init.d/postgresql stop | ||
- sudo apt-get -y --purge remove postgresql libpq-dev libpq5 postgresql-client-common postgresql-common | ||
- sudo rm -rf /var/lib/postgresql | ||
- | | ||
if [ "$COMPONENT" ]; then | ||
sudo sed -i -e "s/main/main $COMPONENT/" /etc/apt/sources.list.d/pgdg*.list | ||
fi | ||
- sudo apt-get update | ||
- sudo apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::="--force-confnew" ${PGREPO:+-t "$PGREPO"} install postgresql-${PG:?} postgresql-server-dev-${PG:?} postgresql-contrib-${PG:?} | ||
- sudo apt-get update -qq | ||
|
||
before_script: | ||
- sudo -u postgres createuser -s "$USER" | ||
install: | ||
# upgrade postgresql-common for new apt.postgresql.org.sh | ||
- sudo apt-get install -y postgresql-common | ||
- sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -p -v $PG_SUPPORTED_VERSIONS -i | ||
- sudo apt-get install -y postgresql-contrib-$PG_SUPPORTED_VERSIONS | ||
|
||
script: | ||
- make | ||
- sudo make install | ||
- make installcheck | ||
|
||
after_script: | ||
- cat regression.diffs || true | ||
- pg_virtualenv make installcheck | ||
- if test -s regression.diffs; then cat regression.diffs; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
SELECT setting::integer < 130000 AS pre_13 | ||
FROM pg_settings WHERE name = 'server_version_num'; | ||
pre_13 | ||
-------- | ||
t | ||
(1 row) | ||
|
||
/* Basic period definitions with dates */ | ||
CREATE TABLE basic (val text, s date, e date); | ||
TABLE periods.periods; | ||
table_name | period_name | start_column_name | end_column_name | range_type | bounds_check_constraint | ||
------------+-------------+-------------------+-----------------+------------+------------------------- | ||
(0 rows) | ||
|
||
SELECT periods.add_period('basic', 'bp', 's', 'e'); | ||
add_period | ||
------------ | ||
t | ||
(1 row) | ||
|
||
TABLE periods.periods; | ||
table_name | period_name | start_column_name | end_column_name | range_type | bounds_check_constraint | ||
------------+-------------+-------------------+-----------------+------------+------------------------- | ||
basic | bp | s | e | daterange | basic_bp_check | ||
(1 row) | ||
|
||
SELECT periods.drop_period('basic', 'bp'); | ||
drop_period | ||
------------- | ||
t | ||
(1 row) | ||
|
||
TABLE periods.periods; | ||
table_name | period_name | start_column_name | end_column_name | range_type | bounds_check_constraint | ||
------------+-------------+-------------------+-----------------+------------+------------------------- | ||
(0 rows) | ||
|
||
SELECT periods.add_period('basic', 'bp', 's', 'e', bounds_check_constraint => 'c'); | ||
add_period | ||
------------ | ||
t | ||
(1 row) | ||
|
||
TABLE periods.periods; | ||
table_name | period_name | start_column_name | end_column_name | range_type | bounds_check_constraint | ||
------------+-------------+-------------------+-----------------+------------+------------------------- | ||
basic | bp | s | e | daterange | c | ||
(1 row) | ||
|
||
SELECT periods.drop_period('basic', 'bp', purge => true); | ||
drop_period | ||
------------- | ||
t | ||
(1 row) | ||
|
||
TABLE periods.periods; | ||
table_name | period_name | start_column_name | end_column_name | range_type | bounds_check_constraint | ||
------------+-------------+-------------------+-----------------+------------+------------------------- | ||
(0 rows) | ||
|
||
SELECT periods.add_period('basic', 'bp', 's', 'e'); | ||
add_period | ||
------------ | ||
t | ||
(1 row) | ||
|
||
TABLE periods.periods; | ||
table_name | period_name | start_column_name | end_column_name | range_type | bounds_check_constraint | ||
------------+-------------+-------------------+-----------------+------------+------------------------- | ||
basic | bp | s | e | daterange | basic_bp_check | ||
(1 row) | ||
|
||
/* Test constraints */ | ||
INSERT INTO basic (val, s, e) VALUES ('x', null, null); --fail | ||
ERROR: null value in column "s" violates not-null constraint | ||
DETAIL: Failing row contains (x, null, null). | ||
INSERT INTO basic (val, s, e) VALUES ('x', '3000-01-01', null); --fail | ||
ERROR: null value in column "e" violates not-null constraint | ||
DETAIL: Failing row contains (x, 01-01-3000, null). | ||
INSERT INTO basic (val, s, e) VALUES ('x', null, '1000-01-01'); --fail | ||
ERROR: null value in column "s" violates not-null constraint | ||
DETAIL: Failing row contains (x, null, 01-01-1000). | ||
INSERT INTO basic (val, s, e) VALUES ('x', '3000-01-01', '1000-01-01'); --fail | ||
ERROR: new row for relation "basic" violates check constraint "basic_bp_check" | ||
DETAIL: Failing row contains (x, 01-01-3000, 01-01-1000). | ||
INSERT INTO basic (val, s, e) VALUES ('x', '1000-01-01', '3000-01-01'); --success | ||
TABLE basic; | ||
val | s | e | ||
-----+------------+------------ | ||
x | 01-01-1000 | 01-01-3000 | ||
(1 row) | ||
|
||
/* Test dropping the whole thing */ | ||
DROP TABLE basic; | ||
TABLE periods.periods; | ||
table_name | period_name | start_column_name | end_column_name | range_type | bounds_check_constraint | ||
------------+-------------+-------------------+-----------------+------------+------------------------- | ||
(0 rows) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters