-
Notifications
You must be signed in to change notification settings - Fork 469
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
DO blocks #19356
DO blocks #19356
Conversation
Files changed:
|
✅ Deploy Preview for cockroachdb-api-docs canceled.
|
✅ Deploy Preview for cockroachdb-interactivetutorials-docs canceled.
|
✅ Netlify Preview
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
src/current/v25.1/do.md
Outdated
|
||
## Required privileges | ||
|
||
- To execute a `DO` block, a user must have at least the [`USAGE` privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) on the schema where the `DO` block is being executed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this one? I don't think it's true in either CRDB or Postgres.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sorry, that was kind of a guess. I ported it over from the CREATE PROCEDURE and CREATE FUNCTION prereqs. What exactly are the privileges we need on DO blocks? The PG doc says The user must have USAGE privilege for the procedural language, or must be a superuser if the language is untrusted. This is the same privilege requirement as for creating a function in the language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't currently do language privileges AFAIK, so I think we should just leave that out for now.
{% remote_include https://raw.githubusercontent.com/cockroachdb/generated-diagrams/{{ page.release_info.crdb_branch_name }}/grammar_svg/do.html %} | ||
</div> | ||
|
||
## Parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note there's also an optional LANGUAGE foo
. SQL is disallowed and we currently only support PL/pgSQL out of the options Postgres allows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this will be in the diagram (will open that PR soon). But I didn't know about SQL being disallowed. So the diagram should only show an optional LANGUAGE PLPGSQL
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the diagram should only show an optional LANGUAGE PLPGSQL?
Yeah, that sounds good.
@DrewKimball Updated, PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
just wondering: should there be a link on plpgsql.md to do.md? Such as:
"PL/pgSQL is a procedural language that you can use within user-defined functions, stored procedures, and DO
blocks in CockroachDB.
"
Great point -- I added this. |
140680: docgen: add DO statement diagram r=DrewKimball a=taroface Added a SQL statement diagram for `DO`. The diagram looks like this: <img width="519" alt="image" src="https://github.com/user-attachments/assets/30feb56a-2085-4fa6-800c-d7920ec4fe49" /> This is necessary for the accompanying docs PR: cockroachdb/docs#19356 Epic: none Release note: none Release justification: non-production code change Co-authored-by: Ryan Kuo <[email protected]>
DOC-10471
Note: This can't merge until a separate
cockroach
PR to add the SQL diagram is merged: cockroachdb/cockroach#140680