Skip to content

Commit 24bc9dd

Browse files
Task LAV-1754: DESC USER + SHOW PARAMETERS IN USER read surfaces (apache#2216)
Add `DESC[RIBE] USER <name>` rendering real Snowflake's 44-row property/value/default/description table via a new `__snowflake$describe_user` UDF that joins the user's jsonb property bag with a static property catalog (stored value wins over default; derived rows NAME/TYPE/PASSWORD/has_*-flags/LOCK_DETAILS computed from the bag). NULL cells render as the literal string 'null', matching real Snowflake. Parser: add `User` variant to `DescribeObjectType` and parse `DESC USER`. Rewriter: route `DESC USER` to the new UDF. Wire the missing-user 002003 error position (DESC USER / DESCRIBE USER prefixes) so the verbatim error snapshot (code/message/data incl. line/pos) matches real Snowflake. New compat tests (snapshots captured on real Snowflake): fresh user, CREATE with properties, ALTER SET/UNSET, missing-user error (snapshot, no pytest.raises), and SHOW PARAMETERS IN USER NETWORK_POLICY no-regression. Co-authored-by: Claude <noreply@anthropic.com>
1 parent 93298f3 commit 24bc9dd

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/ast/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11545,6 +11545,9 @@ pub enum DescribeObjectType {
1154511545
Sequence,
1154611546
/// `PIPE`
1154711547
Pipe,
11548+
/// `USER` (Snowflake)
11549+
/// <https://docs.snowflake.com/en/sql-reference/sql/desc-user>
11550+
User,
1154811551
}
1154911552

1155011553
impl fmt::Display for DescribeObjectType {
@@ -11562,6 +11565,7 @@ impl fmt::Display for DescribeObjectType {
1156211565
DescribeObjectType::Stream => "STREAM",
1156311566
DescribeObjectType::Sequence => "SEQUENCE",
1156411567
DescribeObjectType::Pipe => "PIPE",
11568+
DescribeObjectType::User => "USER",
1156511569
})
1156611570
}
1156711571
}

src/parser/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15399,6 +15399,7 @@ impl<'a> Parser<'a> {
1539915399
Keyword::STREAM,
1540015400
Keyword::SEQUENCE,
1540115401
Keyword::PIPE,
15402+
Keyword::USER,
1540215403
]) {
1540315404
let object_type = match kw {
1540415405
Keyword::TABLE => DescribeObjectType::Table,
@@ -15410,6 +15411,7 @@ impl<'a> Parser<'a> {
1541015411
Keyword::STREAM => DescribeObjectType::Stream,
1541115412
Keyword::SEQUENCE => DescribeObjectType::Sequence,
1541215413
Keyword::PIPE => DescribeObjectType::Pipe,
15414+
Keyword::USER => DescribeObjectType::User,
1541315415
_ => return self.expected("a describe object type", self.peek_token()),
1541415416
};
1541515417
let object_name = self.parse_object_name(false)?;

0 commit comments

Comments
 (0)