Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions crates/pgls_pretty_print/src/nodes/alter_policy_stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ pub(super) fn emit_alter_policy_stmt(e: &mut EventEmitter, n: &AlterPolicyStmt)
e.space();

// Policy name
if !n.policy_name.is_empty() {
e.token(TokenKind::IDENT(n.policy_name.clone()));
}
super::emit_identifier_maybe_quoted(e, &n.policy_name);

// Table name
if let Some(ref table) = n.table {
Expand Down
2 changes: 1 addition & 1 deletion crates/pgls_pretty_print/src/nodes/create_policy_stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub(super) fn emit_create_policy_stmt(e: &mut EventEmitter, n: &CreatePolicyStmt
e.space();
e.token(TokenKind::POLICY_KW);
e.space();
e.token(TokenKind::IDENT(n.policy_name.clone()));
super::emit_identifier_maybe_quoted(e, &n.policy_name);

e.line(LineType::SoftOrSpace);
e.token(TokenKind::ON_KW);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER POLICY "Public can read stats" ON my_table USING (true);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE POLICY "Public can read stats" ON my_table FOR SELECT USING (true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/pgls_pretty_print/tests/tests.rs
input_file: crates/pgls_pretty_print/tests/data/single/alter_policy_quoted_name_0.sql
---
alter policy "Public can read stats" on my_table using (true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/pgls_pretty_print/tests/tests.rs
input_file: crates/pgls_pretty_print/tests/data/single/alter_policy_quoted_name_0.sql
---
alter policy "Public can read stats" on my_table using (true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/pgls_pretty_print/tests/tests.rs
input_file: crates/pgls_pretty_print/tests/data/single/create_policy_quoted_name_0.sql
---
create policy "Public can read stats" on my_table as permissive for select to public using (true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
source: crates/pgls_pretty_print/tests/tests.rs
input_file: crates/pgls_pretty_print/tests/data/single/create_policy_quoted_name_0.sql
---
create policy "Public can read stats"
on my_table
as permissive
for select
to public
using (true);
Loading