Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
0f8e9b4d
Commit
0f8e9b4d
authored
22 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Add a basic regression test for IS DISTINCT FROM, which has spent way too
much time in a broken state for lack of anyone noticing.
parent
3a4f7dde
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/regress/expected/select_distinct.out
+71
-0
71 additions, 0 deletions
src/test/regress/expected/select_distinct.out
src/test/regress/sql/select_distinct.sql
+22
-0
22 additions, 0 deletions
src/test/regress/sql/select_distinct.sql
with
93 additions
and
0 deletions
src/test/regress/expected/select_distinct.out
+
71
−
0
View file @
0f8e9b4d
...
@@ -124,3 +124,74 @@ SELECT DISTINCT p.age FROM person* p ORDER BY age using >;
...
@@ -124,3 +124,74 @@ SELECT DISTINCT p.age FROM person* p ORDER BY age using >;
8
8
(20 rows)
(20 rows)
--
-- Also, some tests of IS DISTINCT FROM, which doesn't quite deserve its
-- very own regression file.
--
CREATE TEMP TABLE disttable (f1 integer);
INSERT INTO DISTTABLE VALUES(1);
INSERT INTO DISTTABLE VALUES(2);
INSERT INTO DISTTABLE VALUES(3);
INSERT INTO DISTTABLE VALUES(NULL);
-- basic cases
SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable;
f1 | not 2
----+-------
1 | t
2 | f
3 | t
| t
(4 rows)
SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable;
f1 | not null
----+----------
1 | t
2 | t
3 | t
| f
(4 rows)
SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable;
f1 | false
----+-------
1 | f
2 | f
3 | f
| f
(4 rows)
SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable;
f1 | not null
----+----------
1 | t
2 | t
3 | t
| f
(4 rows)
-- check that optimizer constant-folds it properly
SELECT 1 IS DISTINCT FROM 2 as "yes";
yes
-----
t
(1 row)
SELECT 2 IS DISTINCT FROM 2 as "no";
no
----
f
(1 row)
SELECT 2 IS DISTINCT FROM null as "yes";
yes
-----
t
(1 row)
SELECT null IS DISTINCT FROM null as "no";
no
----
f
(1 row)
This diff is collapsed.
Click to expand it.
src/test/regress/sql/select_distinct.sql
+
22
−
0
View file @
0f8e9b4d
...
@@ -34,3 +34,25 @@ SELECT DISTINCT two, string4, ten
...
@@ -34,3 +34,25 @@ SELECT DISTINCT two, string4, ten
--
--
SELECT
DISTINCT
p
.
age
FROM
person
*
p
ORDER
BY
age
using
>
;
SELECT
DISTINCT
p
.
age
FROM
person
*
p
ORDER
BY
age
using
>
;
--
-- Also, some tests of IS DISTINCT FROM, which doesn't quite deserve its
-- very own regression file.
--
CREATE
TEMP
TABLE
disttable
(
f1
integer
);
INSERT
INTO
DISTTABLE
VALUES
(
1
);
INSERT
INTO
DISTTABLE
VALUES
(
2
);
INSERT
INTO
DISTTABLE
VALUES
(
3
);
INSERT
INTO
DISTTABLE
VALUES
(
NULL
);
-- basic cases
SELECT
f1
,
f1
IS
DISTINCT
FROM
2
as
"not 2"
FROM
disttable
;
SELECT
f1
,
f1
IS
DISTINCT
FROM
NULL
as
"not null"
FROM
disttable
;
SELECT
f1
,
f1
IS
DISTINCT
FROM
f1
as
"false"
FROM
disttable
;
SELECT
f1
,
f1
IS
DISTINCT
FROM
f1
+
1
as
"not null"
FROM
disttable
;
-- check that optimizer constant-folds it properly
SELECT
1
IS
DISTINCT
FROM
2
as
"yes"
;
SELECT
2
IS
DISTINCT
FROM
2
as
"no"
;
SELECT
2
IS
DISTINCT
FROM
null
as
"yes"
;
SELECT
null
IS
DISTINCT
FROM
null
as
"no"
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment