Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly deparse exprs that might appear in some DDLs #7245

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

onurctirtir
Copy link
Member

e.g.:

CREATE SCHEMA my_schema;
CREATE TYPE my_schema.my_dt AS ENUM ('1','2','3');

CREATE FUNCTION my_schema.my_func()
RETURNS int
LANGUAGE sql
AS $$
SELECT 1;
$$;

CREATE TABLE referencing(a int);
SELECT create_distributed_table('referencing', 'a');

SET search_path TO my_schema, public;
ALTER TABLE referencing ADD check (a > my_func());

Also checked the other places we call deparse_expression() and all except the references in PreprocessAlterPolicyStmt() seem to be fine, so fixed them as well.

DESCRIPTION: Fixes a bug that might cause applying some DDLs on shards incorrectly

TODO: needs tests

@@ -146,15 +147,21 @@ CreatePolicyCommandForPolicy(Oid relationId, RowSecurityPolicy *policy)

if (policy->qual)
{
int saveNestLevel = PushEmptySearchPath();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably have deparse_expression_qualified or such

@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Merging #7245 (15e65db) into main (83e3fb8) will decrease coverage by 3.66%.
Report is 4 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #7245      +/-   ##
==========================================
- Coverage   93.22%   89.57%   -3.66%     
==========================================
  Files         275      275              
  Lines       59527    59582      +55     
  Branches        0     7423    +7423     
==========================================
- Hits        55495    53371    -2124     
- Misses       4032     4080      +48     
- Partials        0     2131    +2131     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants