• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

babelfish-for-postgresql / babelfish_extensions / 11831695974
76%
BABEL_5_X_DEV: 77%

Build:
Build:
LAST BUILD BRANCH: datetime2fromparts_bugfix
DEFAULT BRANCH: BABEL_5_X_DEV
Ran 14 Nov 2024 06:43AM UTC
Jobs 1
Files 115
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Nov 2024 06:08AM UTC coverage: 74.721% (+0.06%) from 74.661%
11831695974

push

github

web-flow
Support for T-SQL variable/parameter names like @@var and @var# (#3073)

Valid names of user-defined T-SQL variables and/or parameters are @@myvar, @myvar#, @#myvar, etc. and indeed we see customer T-SQL applications using such names.
Until now, such names have raised errors in the backend because we can only handle variable/parameter names with one leading @ and without # characters.
This fix adds support by enclosing such variable names in square bracket delimiters; when using double quotes as delimiters (as is currently done in most places for regular-named variables), a query like select @@V will produce the string '@@V' instead of the value of variable @@V.
The fix is partly done through ANTLR rewriting and partly at execution time elsewhere in the babelfish_tsql codeline. Things are complicated by the fact that the ANTLR rewriting logic is very fragmented, as well as that for some variables reference contexts inside the body of a procedure or trigger, rewriting must be postponed until the body is executed. This means there are multiple code paths where these variable names must be intercepted.
This fix also addresses variable names in some contexts (like a cursor variable) that previously could not be longer than 63 characters.
This fix also solves the previous issue that a variable could be declared with a name matching an internal sys function, but was resolved as the intern function instead of the variable, i.e. DECLARE @@RAND INT=123 SELECT @@RAND would return a random number instead of 123.

Issues Resolved: 
BABEL-2481 Parameter declarations containing # characters not handled correctly
BABEL-476 Support local variables/parameters with multiple '@' characters
BABEL-5384 User-defined @@variable should not be mapped to sys function

Signed-off-by: Rob Verschoor rcv@amazon.com

283 of 292 new or added lines in 6 files covered. (96.92%)

19 existing lines in 3 files now uncovered.

45632 of 61070 relevant lines covered (74.72%)

162079.43 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
4
82.08
0.4% contrib/babelfishpg_tsql/src/pl_exec-2.c
5
90.28
0.17% contrib/babelfishpg_tsql/src/tsqlIface.cpp

Uncovered Existing Lines

Lines Coverage ∆ File
1
90.28
0.17% contrib/babelfishpg_tsql/src/tsqlIface.cpp
2
76.03
-0.63% contrib/babelfishpg_tds/src/backend/tds/tdscomm.c
16
19.32
-1.47% contrib/babelfishpg_tsql/src/pl_funcs.c
Jobs
ID Job ID Ran Files Coverage
1 11831695974.1 14 Nov 2024 06:43AM UTC 115
74.72
GitHub Action Run
Source Files on build 11831695974
  • Tree
  • List 115
  • Changed 78
  • Source Changed 6
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #11831695974
  • 24df80ed on github
  • Prev Build on BABEL_4_X_DEV (#11818101440)
  • Next Build on BABEL_4_X_DEV (#11841522137)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc