fix(compute_ctl): Dollar escaping helper fixes (#11263)

## Problem

In the previous PR #11045, one edge-case wasn't covered, when an ident
contains only one `$`, we were picking `$$` as a 'wrapper'. Yet, when
this `$` is at the beginning or at the end of the ident, then we end up
with `$$$` in a row which breaks the escaping.

## Summary of changes

Start from `x` tag instead of a blank string.

Slack:
https://neondb.slack.com/archives/C08HV951W2W/p1742076675079769?thread_ts=1742004205.461159&cid=C08HV951W2W
This commit is contained in:
Alexey Kondratov
2025-03-16 19:39:54 +01:00
committed by GitHub
parent 8566cad23b
commit 966abd3bd6
3 changed files with 19 additions and 3 deletions

View File

@@ -16,6 +16,9 @@ TEST_ROLE_NAMES = [
{"name": "role \";with ';injections $$ $x$ $ %I !/\\&#@"},
{"name": '"role in double quotes"'},
{"name": "'role in single quotes'"},
{"name": "role$"},
{"name": "role$$"},
{"name": "role$x$"},
]
TEST_DB_NAMES = [
@@ -59,6 +62,18 @@ TEST_DB_NAMES = [
"name": "'db in single quotes'",
"owner": "'role in single quotes'",
},
{
"name": "db name$",
"owner": "role$",
},
{
"name": "db name$$",
"owner": "role$$",
},
{
"name": "db name$x$",
"owner": "role$x$",
},
]