vscode-cosmosdb icon indicating copy to clipboard operation
vscode-cosmosdb copied to clipboard

Succeed to execute a query when executing the query with the function name "test," in the opened .psql file

Open v-mengwe opened this issue 3 years ago • 4 comments

OS: Win10 Build Version: 20210323.1

Repro Steps:

  1. Expand a PostgreSQL server -> Postgres -> Right click "functions" node -> Click "Create Function Query..." -> Type function name with "test," -> There is a verification prompt. image
  2. Type a valid function name, e.g. "test" -> Select a return type -> Change the function name to "test," in the opened file -> Click "Execute Query". image
  3. Check whether the query is executed successfully.

Expect: Fail to execute query.

Actual: Succeed to execute query. image

v-mengwe avatar Mar 25 '21 09:03 v-mengwe

I can still run queries against a function with a comma in the name as long as it is wrapped in quotes.

We can possibly remove the "," restriction on the extension creating functions.

neelip avatar May 21 '21 20:05 neelip

Verified on the latest build 20210610.3, this issue also reproduces for other function names. image

v-mengwe avatar Jun 11 '21 06:06 v-mengwe

  • [ ] Update Postgres Function name validation for next release.

neelip avatar Aug 20 '21 20:08 neelip

This issue also reproduce for stored procedures. Create the stored procedure with the name "test*01" successfully after changing the name in the opened .psql file.

v-xinda avatar Dec 28 '21 10:12 v-xinda

I don't know where the validation rule come from but I think it's a recommendation rather than requirement. According to this, people can name things using those characters but it would require more careful handling of them. https://www.postgresql.org/docs/7.0/syntax525.htm#:~:text=Names%20in%20SQL%20must%20begin,but%20they%20will%20be%20truncated.

I'll defer relaxing the validation rules until someone complains.

JasonYeMSFT avatar Sep 20 '23 18:09 JasonYeMSFT