cockroachdb / cockroachdb/cockroach

sql: support `function_name.argument_name` references in UDFs

Open
#102,802 1 comment 0 reactions 0 assignees View on GitHub
A-sql-routine C-enhancement E-quick-win T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

From the [Postgres docs](https://www.postgresql.org/docs/15/xfunc-sql.html):

> If the argument name is the same as any column name in the current SQL command within the function, the column name will take precedence. To override this, qualify the argument name with the name of the function itself, that is function_name.argument_name. (If this would conflict with a qualified column name, again the column name wins. You can avoid the ambiguity by choosing a different alias for the table within the SQL command.)

We don't yet support referencing a function argument with `function_name.argument_name`.

Jira issue: CRDB-27662

Contributor guide

Open the contributing guide

Research direction

The issue names no source file or test entry point. Start with the linked PostgreSQL documentation and locate CockroachDB's SQL UDF argument-resolution code; done means function_name.argument_name references work and follow the documented precedence rules when names conflict with columns.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.