-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reporting jsonb subscripting issue in assessment and analyze (#2129)
Reporting the JSONB subscription in the DMLs, DDLs, and PLPGSQL objects. The approach to detecting these is unclear, so trying to detect as many as possible in the source schema. There are still edge cases that can't be detected easily. https://yugabyte.atlassian.net/browse/DB-14545
- Loading branch information
1 parent
5a50ec5
commit 23db698
Showing
16 changed files
with
557 additions
and
15 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
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 |
---|---|---|
|
@@ -47,6 +47,42 @@ create view sales.employ_depart_view AS SELECT | |
any_value(name) AS any_employee | ||
FROM employees; | ||
|
||
CREATE TABLE sales.test_json_chk ( | ||
id int, | ||
name text, | ||
email text, | ||
active text, | ||
data jsonb, | ||
CHECK (data['key']<>'{}') | ||
); | ||
|
||
INSERT INTO sales.test_json_chk (id, name, email, active, data) | ||
VALUES (1, 'John Doe', '[email protected]', 'Y', jsonb_build_object('key', 'value', 'name', 'John Doe', 'active', 'Y')); | ||
|
||
INSERT INTO sales.test_json_chk (id, name, email, active, data) | ||
VALUES (2, 'Jane Smith', '[email protected]', 'N', jsonb_build_object('key', 'value', 'name', 'Jane Smith', 'active', 'N')); | ||
|
||
CREATE OR REPLACE FUNCTION sales.get_user_info(user_id INT) | ||
RETURNS JSONB AS $$ | ||
BEGIN | ||
PERFORM | ||
data, | ||
data['name'] AS name, | ||
(data['active']) as active | ||
FROM sales.test_json_chk; | ||
|
||
RETURN ( | ||
SELECT jsonb_build_object( | ||
'id', id, | ||
'name', name, | ||
'email', email, | ||
'active', active | ||
) | ||
FROM sales.test_json_chk | ||
WHERE id = user_id | ||
); | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
CREATE TABLE sales.events ( | ||
id int PRIMARY KEY, | ||
event_range daterange | ||
|
@@ -85,4 +121,4 @@ INSERT INTO public.json_data ( | |
3, '[1, 2, 3, 4]', | ||
4, '"hello"', | ||
5, '{"uniqueKey1": "value1", "uniqueKey2": "value2"}' | ||
); | ||
); |
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
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
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
Oops, something went wrong.