Skip to content

PG-1537 Error on required arguments #267

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

Open
wants to merge 6 commits into
base: TDE_REL_17_STABLE
Choose a base branch
from

Conversation

AndersAstrand
Copy link
Collaborator

Do not accept NULL or the empty string for required arguments in our user facing functions.

I'm a bit unsure of where the helper required_text_argument() belongs, any input is appreciated.

@codecov-commenter
Copy link

codecov-commenter commented Apr 25, 2025

Codecov Report

Attention: Patch coverage is 94.87179% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.36%. Comparing base (b7d52ab) to head (ddd2519).

❌ Your project status has failed because the head coverage (78.36%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           TDE_REL_17_STABLE     #267      +/-   ##
=====================================================
+ Coverage              78.34%   78.36%   +0.02%     
=====================================================
  Files                     22       22              
  Lines                   2484     2482       -2     
  Branches                 391      393       +2     
=====================================================
- Hits                    1946     1945       -1     
+ Misses                   462      461       -1     
  Partials                  76       76              
Components Coverage Δ
access 79.35% <ø> (ø)
catalog 86.24% <94.11%> (+<0.01%) ⬆️
common 92.94% <100.00%> (+0.44%) ⬆️
encryption 71.90% <ø> (ø)
keyring 72.07% <ø> (ø)
src 53.79% <ø> (ø)
smgr 98.01% <ø> (ø)
transam ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sort declarations and visually separate static functions from user
facing functions.
Seems like these should belong in the same file as the functions for
creating and modifying these entries.
Move the argument parsing to the _internal function so validation only
have to be done there.
We should reject both null and the empty string in many of our user
facing functions.
Previously these simply crashed the server on NULL input, require these
parameters to be non-null, and also do not accept the empty string.
Passing NULL here crashed the server. Also do not accept the empty
string.
@AndersAstrand AndersAstrand force-pushed the tde/validate-input-in-user-functions branch from 3f5fb21 to ddd2519 Compare April 25, 2025 17:54

if (!PG_ARGISNULL(arg_num))
{
value = text_to_cstring(PG_GETARG_TEXT_PP(arg_num));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we have a separate error message for this, e.g. like the below?

# SELECT * FROM pg_create_physical_replication_slot('');
ERROR:  replication slot name "" is too short

Copy link
Collaborator Author

@AndersAstrand AndersAstrand Apr 26, 2025

Choose a reason for hiding this comment

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

I'm not sure I see the value in that. But we can if we want to! :)

If we do that we should probably only do it when creating stuff and accept the empty string (and never find anything) when looking things up.

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.

3 participants