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

Disallow the use of user-defined functions in column defaults for temp tables and table variables. #3122

Open
wants to merge 2 commits into
base: BABEL_4_X_DEV
Choose a base branch
from

Conversation

Sairakan
Copy link
Contributor

Description

In SQL Server, it is prohibited for users to use user-defined functions as column defaults in temp tables and table variables - the only exception is in the tempdb database, but this is not currently even supported in Babelfish, so for now we will impose the same restrictions as exist elsewhere in SQL Server.

Issues Resolved

BABEL-4868

Test Scenarios Covered

  • Use case based -

  • Boundary conditions -

  • Arbitrary inputs -

  • Negative test cases -

  • Minor version upgrade tests -

  • Major version upgrade tests -

  • Performance tests -

  • Tooling impact -

  • Client tests -

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Jason Teng added 2 commits November 14, 2024 21:25
…p tables and table variables.

Signed-off-by: Jason Teng <jasonten@amazon.com>
Signed-off-by: Jason Teng <jasonten@amazon.com>
@coveralls
Copy link
Collaborator

coveralls commented Nov 14, 2024

Pull Request Test Coverage Report for Build 11846239624

Details

  • 19 of 19 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.008%) to 74.729%

Totals Coverage Status
Change from base Build 11841522137: 0.008%
Covered Lines: 45649
Relevant Lines: 61086

💛 - Coveralls

owa->objname = name_to_search;
owa->args_unspecified = true;

if (LookupFuncWithArgs(OBJECT_FUNCTION, owa, true))
Copy link
Contributor

Choose a reason for hiding this comment

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

how expensive is this call? I think it should be fine assuming it's just syscache lookups, since this would only be called in very rare cases when we need to actually check a column default function on a temp table.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how expensive this call is, but as you said, this is buried below sufficient levels of checking that it shouldn't come up very often in the code path anyways. Basically, this would only get evaluated if we are dealing with a temp table using a function for a column default, and the function call is not schema-qualified. I suppose it could be made more efficient if we generated a list of all possible system functions and did a direct comparison against that list, but that seems like a lot of work.

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