Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
fcfb4d1d
Commit
fcfb4d1d
authored
Oct 17, 1997
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes due to fixed DEFAULT behaviour.
parent
629e8951
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
148 additions
and
155 deletions
+148
-155
src/test/regress/GNUmakefile
src/test/regress/GNUmakefile
+3
-2
src/test/regress/data/constrf.data
src/test/regress/data/constrf.data
+2
-1
src/test/regress/data/constro.data
src/test/regress/data/constro.data
+2
-3
src/test/regress/expected/triggers.out
src/test/regress/expected/triggers.out
+39
-34
src/test/regress/input/constraints.source
src/test/regress/input/constraints.source
+21
-25
src/test/regress/input/create_function_1.source
src/test/regress/input/create_function_1.source
+6
-0
src/test/regress/output/constraints.source
src/test/regress/output/constraints.source
+57
-83
src/test/regress/output/create_function_1.source
src/test/regress/output/create_function_1.source
+5
-0
src/test/regress/sql/triggers.sql
src/test/regress/sql/triggers.sql
+13
-7
No files found.
src/test/regress/GNUmakefile
View file @
fcfb4d1d
...
...
@@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.1
1 1997/09/24 08:35:07
vadim Exp $
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.1
2 1997/10/17 09:57:49
vadim Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -43,7 +43,8 @@ endif
all
:
$(INFILES)
cd
input
;
$(MAKE)
all
;
cd
..
cd
output
;
$(MAKE)
all
;
cd
..
$(MAKE)
-C
../../../contrib/spi
REFINT_VERBOSE
=
1 refint
$(DLSUFFIX)
$(MAKE)
-C
../../../contrib/spi
REFINT_VERBOSE
=
1 refint
$(DLSUFFIX)
\
autoinc
$(DLSUFFIX)
#
# run the test
...
...
src/test/regress/data/constrf.data
View file @
fcfb4d1d
\N \N \N
5 !check failed 6
7 check failed 6
src/test/regress/data/constro.data
View file @
fcfb4d1d
\N \N \N
\N \N \N
\N \N \N
4 !check failed 5
6 OK 4
src/test/regress/expected/triggers.out
View file @
fcfb4d1d
...
...
@@ -163,60 +163,65 @@ QUERY: create sequence ttdummy_seq increment 10 start 0 minvalue 0;
QUERY: create table tttest (
price_id int4,
price_val int4,
price_on int4
default nextval('ttdummy_seq')
,
price_on int4,
price_off int4 default 999999
);
QUERY: insert into tttest values (1, 1, null, null);
QUERY: insert into tttest values (2, 2, null, null);
QUERY: insert into tttest values (3, 3, null, null);
QUERY: create trigger ttdummy
before delete or update on tttest
for each row
execute procedure
ttdummy (price_on, price_off);
QUERY: create trigger ttserial
before insert or update on tttest
for each row
execute procedure
autoinc (price_on, ttdummy_seq);
QUERY: insert into tttest values (1, 1, null);
QUERY: insert into tttest values (2, 2, null);
QUERY: insert into tttest values (3, 3, 0);
QUERY: select * from tttest;
price_id|price_val|price_on|price_off
--------+---------+--------+---------
1| 1|
0| 999999
2| 2|
1
0| 999999
3| 3|
2
0| 999999
1| 1|
1
0| 999999
2| 2|
2
0| 999999
3| 3|
3
0| 999999
(3 rows)
QUERY: delete from tttest where price_id = 2;
QUERY: select * from tttest;
price_id|price_val|price_on|price_off
--------+---------+--------+---------
1| 1|
0| 999999
3| 3|
2
0| 999999
2| 2|
10| 3
0
1| 1|
1
0| 999999
3| 3|
3
0| 999999
2| 2|
20| 4
0
(3 rows)
QUERY: select * from tttest where price_off = 999999;
price_id|price_val|price_on|price_off
--------+---------+--------+---------
1| 1|
0| 999999
3| 3|
2
0| 999999
1| 1|
1
0| 999999
3| 3|
3
0| 999999
(2 rows)
QUERY: update tttest set price_val = 30 where price_id = 3;
QUERY: select * from tttest;
price_id|price_val|price_on|price_off
--------+---------+--------+---------
1| 1|
0| 999999
2| 2|
10| 3
0
3| 30|
4
0| 999999
3| 3|
20| 4
0
1| 1|
1
0| 999999
2| 2|
20| 4
0
3| 30|
5
0| 999999
3| 3|
30| 5
0
(4 rows)
QUERY: update tttest set price_id = 5 where price_id = 3;
QUERY: select * from tttest;
price_id|price_val|price_on|price_off
--------+---------+--------+---------
1| 1|
0| 999999
2| 2|
10| 3
0
3| 3|
20| 4
0
5| 30|
5
0| 999999
3| 30|
40| 5
0
1| 1|
1
0| 999999
2| 2|
20| 4
0
3| 3|
30| 5
0
5| 30|
6
0| 999999
3| 30|
50| 6
0
(5 rows)
QUERY: select set_ttdummy(0);
...
...
@@ -230,20 +235,20 @@ QUERY: update tttest set price_off = 999999 where price_val = 30;
QUERY: select * from tttest;
price_id|price_val|price_on|price_off
--------+---------+--------+---------
1| 1|
0| 999999
2| 2|
10| 3
0
3| 3|
20| 4
0
3| 30|
4
0| 999999
1| 1|
1
0| 999999
2| 2|
20| 4
0
3| 3|
30| 5
0
3| 30|
5
0| 999999
(4 rows)
QUERY: update tttest set price_id = 5 where price_id = 3;
QUERY: select * from tttest;
price_id|price_val|price_on|price_off
--------+---------+--------+---------
1| 1|
0| 999999
2| 2|
10| 3
0
5| 3|
20| 4
0
5| 30|
4
0| 999999
1| 1|
1
0| 999999
2| 2|
20| 4
0
5| 3|
30| 5
0
5| 30|
5
0| 999999
(4 rows)
QUERY: select set_ttdummy(1);
...
...
@@ -264,16 +269,16 @@ QUERY: update tttest set price_on = -1 where price_id = 1;
QUERY: select * from tttest;
price_id|price_val|price_on|price_off
--------+---------+--------+---------
2| 2|
10| 3
0
5| 3|
20| 4
0
5| 30|
4
0| 999999
2| 2|
20| 4
0
5| 3|
30| 5
0
5| 30|
5
0| 999999
1| 1| -1| 999999
(4 rows)
QUERY: select * from tttest where price_on <=
25 and price_off > 2
5 and price_id = 5;
QUERY: select * from tttest where price_on <=
35 and price_off > 3
5 and price_id = 5;
price_id|price_val|price_on|price_off
--------+---------+--------+---------
5| 3|
20| 4
0
5| 3|
30| 5
0
(1 row)
QUERY: drop table tttest;
...
...
src/test/regress/input/constraints.source
View file @
fcfb4d1d
...
...
@@ -14,6 +14,7 @@ INSERT INTO DEFAULT_TBL VALUES (1, 'thomas', 57.0613);
INSERT INTO DEFAULT_TBL VALUES (1, 'bruce');
INSERT INTO DEFAULT_TBL (i, f) VALUES (2, 987.654);
INSERT INTO DEFAULT_TBL (x) VALUES ('tgl');
INSERT INTO DEFAULT_TBL VALUES (3, null, 1.0);
SELECT '' AS four, * FROM DEFAULT_TBL;
...
...
@@ -66,28 +67,30 @@ CREATE SEQUENCE INSERT_SEQ;
CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'),
y TEXT DEFAULT '-NULL-', z INT DEFAULT -1 * currval('insert_seq') )
CONSTRAINT INSERT_CON CHECK (x > 3 AND y <> 'check failed' AND x < 8),
CONSTRAINT INSERT_CON CHECK (x >
=
3 AND y <> 'check failed' AND x < 8),
CHECK x + z = 0;
INSERT INTO INSERT_TBL VALUES (null, null, null);
INSERT INTO INSERT_TBL
VALUES (null, null
, -2);
INSERT INTO INSERT_TBL
(x,z) VALUES (2
, -2);
SELECT * FROM INSERT_TBL;
SELECT nextval('insert_seq');
INSERT INTO INSERT_TBL VALUES (null, null, null);
INSERT INTO INSERT_TBL VALUES (1, null, -2);
INSERT INTO INSERT_TBL VALUES (7, null, -7);
INSERT INTO INSERT_TBL(y) VALUES ('Y');
INSERT INTO INSERT_TBL(y) VALUES ('Y');
INSERT INTO INSERT_TBL(x,z) VALUES (1, -2);
INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7);
INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5);
INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7);
INSERT INTO INSERT_TBL
VALUES (null, null, null
);
INSERT INTO INSERT_TBL
(y) VALUES ('-!NULL-'
);
SELECT * FROM INSERT_TBL;
INSERT INTO INSERT_TBL
VALUES (null, 'check failed', 5
);
INSERT INTO INSERT_TBL
VALUES (5, 'check failed', null
);
INSERT INTO INSERT_TBL
VALUES (5, '!check failed', null
);
INSERT INTO INSERT_TBL
VALUES (null, null, null
);
INSERT INTO INSERT_TBL
(y,z) VALUES ('check failed', 4
);
INSERT INTO INSERT_TBL
(x,y) VALUES (5, 'check failed'
);
INSERT INTO INSERT_TBL
(x,y) VALUES (5, '!check failed'
);
INSERT INTO INSERT_TBL
(y) VALUES ('-!NULL-'
);
SELECT * FROM INSERT_TBL;
INSERT INTO INSERT_TBL VALUES (null, null, null);
SELECT nextval('insert_seq');
INSERT INTO INSERT_TBL(y) VALUES ('Y');
SELECT currval('insert_seq');
--
...
...
@@ -99,13 +102,14 @@ DROP SEQUENCE INSERT_SEQ;
CREATE SEQUENCE INSERT_SEQ START 4;
CREATE TABLE TEMP (xd INT, yd TEXT, zd INT);
SELECT nextval('insert_seq');
INSERT INTO TEMP VALUES (null, null, null);
INSERT INTO TEMP VALUES (null, 'Y', null);
INSERT INTO TEMP VALUES (5, '!check failed', null);
INSERT INTO TEMP VALUES (null, 'try again', null);
INSERT INTO INSERT_TBL
SELECT * FROM
TEMP;
INSERT INTO INSERT_TBL
(y) select yd from
TEMP;
SELECT * FROM INSERT_TBL;
INSERT INTO INSERT_TBL SELECT * FROM TEMP WHERE yd = 'try again';
INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM TEMP WHERE yd = 'try again';
INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM TEMP WHERE yd = 'try again';
SELECT * FROM INSERT_TBL;
DROP TABLE TEMP;
...
...
@@ -115,28 +119,20 @@ DROP TABLE TEMP;
--
UPDATE INSERT_TBL SET x = NULL WHERE x = 6;
SELECT currval('insert_seq');
SELECT * FROM INSERT_TBL;
UPDATE INSERT_TBL SET x = 6 WHERE x = 6;
SELECT * FROM INSERT_TBL;
UPDATE INSERT_TBL SET x = -z, z = -x;
UPDATE INSERT_TBL SET x = z, z = x;
SELECT * FROM INSERT_TBL;
--
-- Check constraints on COPY FROM
--
CREATE SEQUENCE COPY_SEQ START 4;
CREATE TABLE COPY_TBL (x INT DEFAULT nextval('copy_seq'),
y TEXT DEFAULT '-NULL-', z INT DEFAULT -1 * currval('copy_seq') )
CONSTRAINT COPY_CON CHECK (x > 3 AND y <> 'check failed' AND x < 7 ),
CHECK x + z = 0;
CREATE TABLE COPY_TBL (x INT, y TEXT, z INT)
CONSTRAINT COPY_CON CHECK (x > 3 AND y <> 'check failed' AND x < 7 );
COPY COPY_TBL FROM '_OBJWD_/data/constro.data';
SELECT * FROM COPY_TBL;
COPY COPY_TBL FROM '_OBJWD_/data/constrf.data';
SELECT * FROM COPY_TBL;
select nextval('copy_seq') - 1 as currval;
src/test/regress/input/create_function_1.source
View file @
fcfb4d1d
...
...
@@ -25,6 +25,12 @@ CREATE FUNCTION check_foreign_key ()
LANGUAGE 'c'
;
CREATE FUNCTION autoinc ()
RETURNS opaque
AS '_OBJWD_/../../../contrib/spi/autoinc_DLSUFFIX_'
LANGUAGE 'c'
;
CREATE FUNCTION funny_dup17 ()
RETURNS opaque
AS '_OBJWD_/regress_DLSUFFIX_'
...
...
src/test/regress/output/constraints.source
View file @
fcfb4d1d
...
...
@@ -4,6 +4,7 @@ QUERY: INSERT INTO DEFAULT_TBL VALUES (1, 'thomas', 57.0613);
QUERY: INSERT INTO DEFAULT_TBL VALUES (1, 'bruce');
QUERY: INSERT INTO DEFAULT_TBL (i, f) VALUES (2, 987.654);
QUERY: INSERT INTO DEFAULT_TBL (x) VALUES ('tgl');
QUERY: INSERT INTO DEFAULT_TBL VALUES (3, null, 1.0);
QUERY: SELECT '' AS four, * FROM DEFAULT_TBL;
four| i|x | f
----+---+------+-------
...
...
@@ -11,7 +12,8 @@ four| i|x | f
| 1|bruce |123.456
| 2|vadim |987.654
|100|tgl |123.456
(4 rows)
| 3| | 1
(5 rows)
QUERY: CREATE SEQUENCE DEFAULT_SEQ;
QUERY: CREATE TABLE DEFAULTEXPR_TBL (i1 int DEFAULT 100 + (200-199) * 2,
...
...
@@ -26,7 +28,7 @@ four| i1|i2
| -1|-2
| -3| 1
|102|-4
|102|
2
|102|
(4 rows)
QUERY: CREATE TABLE error_tbl (i int DEFAULT (100, ));
...
...
@@ -59,11 +61,11 @@ QUERY: INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7);
QUERY: CREATE SEQUENCE INSERT_SEQ;
QUERY: CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'),
y TEXT DEFAULT '-NULL-', z INT DEFAULT -1 * currval('insert_seq') )
CONSTRAINT INSERT_CON CHECK (x > 3 AND y <> 'check failed' AND x < 8),
CONSTRAINT INSERT_CON CHECK (x >
=
3 AND y <> 'check failed' AND x < 8),
CHECK x + z = 0;
QUERY: INSERT INTO INSERT_TBL VALUES (null, null, null);
WARN:ExecAppend: rejected due to CHECK constraint
insert_con
QUERY: INSERT INTO INSERT_TBL
VALUES (null, null
, -2);
WARN:ExecAppend: rejected due to CHECK constraint
$2
QUERY: INSERT INTO INSERT_TBL
(x,z) VALUES (2
, -2);
WARN:ExecAppend: rejected due to CHECK constraint insert_con
QUERY: SELECT * FROM INSERT_TBL;
x|y|z
...
...
@@ -73,44 +75,52 @@ x|y|z
QUERY: SELECT nextval('insert_seq');
nextval
-------
3
1
(1 row)
QUERY: INSERT INTO INSERT_TBL VALUES (null, null, null);
QUERY: INSERT INTO INSERT_TBL VALUES (1, null, -2);
QUERY: INSERT INTO INSERT_TBL(y) VALUES ('Y');
WARN:ExecAppend: rejected due to CHECK constraint insert_con
QUERY: INSERT INTO INSERT_TBL(y) VALUES ('Y');
QUERY: INSERT INTO INSERT_TBL(x,z) VALUES (1, -2);
WARN:ExecAppend: rejected due to CHECK constraint $2
QUERY: INSERT INTO INSERT_TBL
VALUES (7, null, -
7);
QUERY: INSERT INTO INSERT_TBL
(z,x) VALUES (-7,
7);
QUERY: INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5);
WARN:ExecAppend: rejected due to CHECK constraint insert_con
QUERY: INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7);
QUERY: INSERT INTO INSERT_TBL
VALUES (null, null, null
);
QUERY: INSERT INTO INSERT_TBL
(y) VALUES ('-!NULL-'
);
QUERY: SELECT * FROM INSERT_TBL;
x|y | z
-+-------------+--
4|-NULL- |-4
3|Y |-3
7|-NULL- |-7
7|!check failed|-7
5|-NULL- |-5
4|-!NULL- |-4
(4 rows)
QUERY: INSERT INTO INSERT_TBL VALUES (null, 'check failed', 5);
WARN:ExecAppend: rejected due to CHECK constraint $2
QUERY: INSERT INTO INSERT_TBL VALUES (5, 'check failed', null);
QUERY: INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4);
WARN:ExecAppend: rejected due to CHECK constraint $2
QUERY: INSERT INTO INSERT_TBL VALUES (5, '!check failed', null);
WARN:ExecAppend: rejected due to CHECK constraint $2
QUERY: INSERT INTO INSERT_TBL VALUES (null, null, null);
QUERY: INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed');
WARN:ExecAppend: rejected due to CHECK constraint insert_con
QUERY: INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed');
QUERY: INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
QUERY: SELECT * FROM INSERT_TBL;
x|y | z
-+-------------+--
4|-NULL- |-4
3|Y |-3
7|-NULL- |-7
7|!check failed|-7
5|-NULL- |-5
7|-NULL- |-7
(5 rows)
4|-!NULL- |-4
5|!check failed|-5
6|-!NULL- |-6
(6 rows)
QUERY: INSERT INTO INSERT_TBL VALUES (null, null, null);
QUERY: SELECT nextval('insert_seq');
nextval
-------
7
(1 row)
QUERY: INSERT INTO INSERT_TBL(y) VALUES ('Y');
WARN:ExecAppend: rejected due to CHECK constraint insert_con
QUERY: SELECT currval('insert_seq');
currval
...
...
@@ -122,31 +132,28 @@ QUERY: DELETE FROM INSERT_TBL;
QUERY: DROP SEQUENCE INSERT_SEQ;
QUERY: CREATE SEQUENCE INSERT_SEQ START 4;
QUERY: CREATE TABLE TEMP (xd INT, yd TEXT, zd INT);
QUERY: SELECT nextval('insert_seq');
NOTICE:insert_seq.nextval: sequence was re-created
nextval
-------
4
(1 row)
QUERY: INSERT INTO TEMP VALUES (null, null, null);
QUERY: INSERT INTO TEMP VALUES (null, 'Y', null);
QUERY: INSERT INTO TEMP VALUES (5, '!check failed', null);
QUERY: INSERT INTO TEMP VALUES (null, 'try again', null);
QUERY: INSERT INTO INSERT_TBL SELECT * FROM TEMP;
QUERY: INSERT INTO INSERT_TBL(y) select yd from TEMP;
NOTICE:insert_seq.nextval: sequence was re-created
QUERY: SELECT * FROM INSERT_TBL;
x|y | z
-+-------------+--
5|-NULL- |-5
4|Y |-4
5|!check failed|-5
6|try again |-6
(3 rows)
QUERY: INSERT INTO INSERT_TBL SELECT * FROM TEMP WHERE yd = 'try again';
WARN:ExecAppend: rejected due to CHECK constraint $2
QUERY: INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM TEMP WHERE yd = 'try again';
QUERY: INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM TEMP WHERE yd = 'try again';
WARN:ExecAppend: rejected due to CHECK constraint insert_con
QUERY: SELECT * FROM INSERT_TBL;
x|y | z
-+-------------+--
5|-NULL- |-5
4|Y |-4
5|!check failed|-5
6|try again |-6
7|try again |-7
...
...
@@ -155,68 +162,35 @@ x|y | z
QUERY: DROP TABLE TEMP;
QUERY: UPDATE INSERT_TBL SET x = NULL WHERE x = 6;
WARN:ExecReplace: rejected due to CHECK constraint $2
QUERY: SELECT currval('insert_seq');
currval
-------
8
(1 row)
QUERY: SELECT * FROM INSERT_TBL;
x|y | z
-+-------------+--
5|-NULL- |-5
5|!check failed|-5
6|try again |-6
7|try again |-7
(4 rows)
QUERY: UPDATE INSERT_TBL SET x = 6 WHERE x = 6;
QUERY: SELECT * FROM INSERT_TBL;
x|y | z
-+-------------+--
5|-NULL- |-5
5|!check failed|-5
7|try again |-7
6|try again |-6
(4 rows)
QUERY: UPDATE INSERT_TBL SET x = -z, z = -x;
QUERY: UPDATE INSERT_TBL SET x = z, z = x;
WARN:ExecReplace: rejected due to CHECK constraint insert_con
QUERY: SELECT * FROM INSERT_TBL;
x|y | z
-+-------------+--
5|-NULL- |-5
4|Y |-4
5|!check failed|-5
7|try again |-7
6|try again |-6
(4 rows)
QUERY: CREATE SEQUENCE COPY_SEQ START 4;
QUERY: CREATE TABLE COPY_TBL (x INT DEFAULT nextval('copy_seq'),
y TEXT DEFAULT '-NULL-', z INT DEFAULT -1 * currval('copy_seq') )
CONSTRAINT COPY_CON CHECK (x > 3 AND y <> 'check failed' AND x < 7 ),
CHECK x + z = 0;
QUERY: CREATE TABLE COPY_TBL (x INT, y TEXT, z INT)
CONSTRAINT COPY_CON CHECK (x > 3 AND y <> 'check failed' AND x < 7 );
QUERY: COPY COPY_TBL FROM '_OBJWD_/data/constro.data';
QUERY: SELECT * FROM COPY_TBL;
x|y | z
-+------+--
4|-NULL-|-4
5|-NULL-|-5
6|-NULL-|-6
(3 rows)
x|y |z
-+-------------+-
4|!check failed|5
6|OK |4
(2 rows)
QUERY: COPY COPY_TBL FROM '_OBJWD_/data/constrf.data';
WARN:CopyFrom: rejected due to CHECK constraint copy_con
QUERY: SELECT * FROM COPY_TBL;
x|y | z
-+------+--
4|-NULL-|-4
5|-NULL-|-5
6|-NULL-|-6
(3 rows)
QUERY: select nextval('copy_seq') - 1 as currval;
currval
-------
7
(1 row)
x|y |z
-+-------------+-
4|!check failed|5
6|OK |4
(2 rows)
src/test/regress/output/create_function_1.source
View file @
fcfb4d1d
...
...
@@ -17,6 +17,11 @@ QUERY: CREATE FUNCTION check_foreign_key ()
AS '_OBJWD_/../../../contrib/spi/refint_DLSUFFIX_'
LANGUAGE 'c'
;
QUERY: CREATE FUNCTION autoinc ()
RETURNS opaque
AS '_OBJWD_/../../../contrib/spi/autoinc_DLSUFFIX_'
LANGUAGE 'c'
;
QUERY: CREATE FUNCTION funny_dup17 ()
RETURNS opaque
AS '_OBJWD_/regress_DLSUFFIX_'
...
...
src/test/regress/sql/triggers.sql
View file @
fcfb4d1d
...
...
@@ -122,20 +122,26 @@ create sequence ttdummy_seq increment 10 start 0 minvalue 0;
create
table
tttest
(
price_id
int4
,
price_val
int4
,
price_on
int4
default
nextval
(
'ttdummy_seq'
)
,
price_on
int4
,
price_off
int4
default
999999
);
insert
into
tttest
values
(
1
,
1
,
null
,
null
);
insert
into
tttest
values
(
2
,
2
,
null
,
null
);
insert
into
tttest
values
(
3
,
3
,
null
,
null
);
create
trigger
ttdummy
before
delete
or
update
on
tttest
for
each
row
execute
procedure
ttdummy
(
price_on
,
price_off
);
create
trigger
ttserial
before
insert
or
update
on
tttest
for
each
row
execute
procedure
autoinc
(
price_on
,
ttdummy_seq
);
insert
into
tttest
values
(
1
,
1
,
null
);
insert
into
tttest
values
(
2
,
2
,
null
);
insert
into
tttest
values
(
3
,
3
,
0
);
select
*
from
tttest
;
delete
from
tttest
where
price_id
=
2
;
select
*
from
tttest
;
...
...
@@ -176,8 +182,8 @@ update tttest set price_on = -1 where price_id = 1;
select
*
from
tttest
;
-- isn't it what we need ?
-- get price for price_id == 5 as it was @ "date"
2
5
select
*
from
tttest
where
price_on
<=
25
and
price_off
>
2
5
and
price_id
=
5
;
-- get price for price_id == 5 as it was @ "date"
3
5
select
*
from
tttest
where
price_on
<=
35
and
price_off
>
3
5
and
price_id
=
5
;
drop
table
tttest
;
drop
sequence
ttdummy_seq
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment