Skip to content

Conversation

SanjulaGanepola
Copy link
Member

@SanjulaGanepola SanjulaGanepola commented Oct 10, 2025

Changes

This PR adds udtf as a new SQL prefix for generating the skeleton for a user-defined table function as requested in #458

image

Signed-off-by: Sanjula Ganepola <[email protected]>
Signed-off-by: Sanjula Ganepola <[email protected]>
@SanjulaGanepola SanjulaGanepola requested review from a team and forstie October 10, 2025 00:16
Copy link

github-actions bot commented Oct 10, 2025

👋 A new build is available for this PR based on 9670650.

@forstie
Copy link
Collaborator

forstie commented Oct 10, 2025

I think we should add some of the most important UDTF keywords.

NOT DETERMINISTIC
NO EXTERNAL ACTION
READS SQL DATA
SET OPTION
COMMIT = *NONE ,
DYNUSRPRF = *USER ,
USRPRF = *USER

@SanjulaGanepola
Copy link
Member Author

I think we should add some of the most important UDTF keywords.

Done! I updated the screen cap above

@forstie
Copy link
Collaborator

forstie commented Oct 11, 2025

ON Common1, I did
udtf: select * from dogshow.account

Any and all columns returned by the udtf should be referenced by name.
Using SELECT * means that the UDTF will break when a column is added later.

`-- statement:
-- select * from dogshow.account

-- User-defined table function
CREATE OR REPLACE FUNCTION MyFunction()
RETURNS TABLE (
CLINAME VARCHAR(100)
)
NOT DETERMINISTIC
NO EXTERNAL ACTION
READS SQL DATA
SET OPTION COMMIT = *NONE,
DYNUSRPRF = *USER,
USRPRF = *USER
BEGIN
RETURN select * from dogshow.account;
END;`

@forstie
Copy link
Collaborator

forstie commented Oct 11, 2025

Delimited column names aren't handled by the support.
Example:


-- statement:
-- update: SELECT "cLo" FROM "CaMel"."CoWt"

-- User-defined table function
CREATE OR REPLACE FUNCTION MyFunction()
  RETURNS TABLE (
    cLo INTEGER
  )
  NOT DETERMINISTIC
  NO EXTERNAL ACTION
  READS SQL DATA
  SET OPTION COMMIT = *NONE,
             DYNUSRPRF = *USER,
             USRPRF = *USER
  BEGIN
    RETURN SELECT * FROM "CaMel"."CoWt";
  END;

Copy link
Contributor

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

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

@SanjulaGanepola See comments by @forstie for required changes.

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.

SQL prefixes add prefix to create SQL table function return list

3 participants