Skip to content

Commit

Permalink
[#24452] YSQL: Disable NULLS NOT DISTINCT
Browse files Browse the repository at this point in the history
Summary:
Till we add support for NULLS NOT DISTINCT (GH #24399), block the command.
Jira: DB-13358

Test Plan:
   ./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressInsertOnConflict'

Reviewers: fizaa

Reviewed By: fizaa

Subscribers: smishra, yql

Differential Revision: https://phorge.dev.yugabyte.com/D38969
  • Loading branch information
arpang committed Oct 15, 2024
1 parent 749d46b commit f0d98a6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/postgres/src/backend/parser/gram.y
Original file line number Diff line number Diff line change
Expand Up @@ -4248,7 +4248,11 @@ ColConstraintElem:

opt_unique_null_treatment:
NULLS_P DISTINCT { $$ = true; }
| NULLS_P NOT DISTINCT { $$ = false; }
| NULLS_P NOT DISTINCT
{
parser_ybc_signal_unsupported(@1, "UNIQUE NULLS NOT DISTINCT", 24399);
$$ = false;
}
| /*EMPTY*/ { $$ = true; }
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,12 @@ SELECT * FROM ab_tab WHERE a IS NULL ORDER BY b;
DELETE FROM ab_tab WHERE a IS null;
-- NULLS NOT DISTINCT
DROP INDEX ah_idx;
/* TODO(jason): uncomment when NULLS NOT DISTINCT is either supported or blocked
CREATE UNIQUE INDEX NONCONCURRENTLY ah_idx ON ab_tab (a HASH) NULLS NOT DISTINCT;
ERROR: UNIQUE NULLS NOT DISTINCT not supported yet
LINE 1: ...E INDEX NONCONCURRENTLY ah_idx ON ab_tab (a HASH) NULLS NOT ...
^
HINT: See https://github.com/yugabyte/yugabyte-db/issues/24399. React with thumbs up to raise its priority
/* TODO(jason): uncomment when NULLS NOT DISTINCT is supported
INSERT INTO ab_tab VALUES (null, null);
INSERT INTO ab_tab VALUES (null, null) ON CONFLICT DO NOTHING;
SELECT * FROM ab_tab WHERE a IS NULL ORDER BY b;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,12 @@ SELECT * FROM ab_tab WHERE a IS NULL ORDER BY b;
DELETE FROM ab_tab WHERE a IS null;
-- NULLS NOT DISTINCT
DROP INDEX ah_idx;
/* TODO(jason): uncomment when NULLS NOT DISTINCT is either supported or blocked
CREATE UNIQUE INDEX NONCONCURRENTLY ah_idx ON ab_tab (a HASH) NULLS NOT DISTINCT;
ERROR: UNIQUE NULLS NOT DISTINCT not supported yet
LINE 1: ...E INDEX NONCONCURRENTLY ah_idx ON ab_tab (a HASH) NULLS NOT ...
^
HINT: See https://github.com/yugabyte/yugabyte-db/issues/24399. React with thumbs up to raise its priority
/* TODO(jason): uncomment when NULLS NOT DISTINCT is supported
INSERT INTO ab_tab VALUES (null, null);
INSERT INTO ab_tab VALUES (null, null) ON CONFLICT DO NOTHING;
SELECT * FROM ab_tab WHERE a IS NULL ORDER BY b;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ SELECT * FROM ab_tab WHERE a IS NULL ORDER BY b;
DELETE FROM ab_tab WHERE a IS null;
-- NULLS NOT DISTINCT
DROP INDEX ah_idx;
/* TODO(jason): uncomment when NULLS NOT DISTINCT is either supported or blocked
CREATE UNIQUE INDEX NONCONCURRENTLY ah_idx ON ab_tab (a HASH) NULLS NOT DISTINCT;
/* TODO(jason): uncomment when NULLS NOT DISTINCT is supported
INSERT INTO ab_tab VALUES (null, null);
INSERT INTO ab_tab VALUES (null, null) ON CONFLICT DO NOTHING;
SELECT * FROM ab_tab WHERE a IS NULL ORDER BY b;
Expand Down

0 comments on commit f0d98a6

Please sign in to comment.