Skip to content

Commit 35134ab

Browse files
Merge pull request taozhi8833998#2592 from taozhi8833998/feat-latin-unicode-tsql
feat: support Latin-1 Supplement unicode as column name in tsql
2 parents afca143 + fd2a139 commit 35134ab

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pegjs/transactsql.pegjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,10 +2602,10 @@ ident_name_list
26022602

26032603
ident_start = [A-Za-z_@#\u4e00-\u9fa5]
26042604

2605-
ident_part = [A-Za-z0-9_\-@$$\u4e00-\u9fa5\u00C0-\u017F]
2605+
ident_part = [A-Za-z0-9_\-@$$\u4e00-\u9fa5\u00C0-\u017F\u0080-\u00FF]
26062606

26072607
// to support column name like `cf1:name` in hbase
2608-
column_part = [A-Za-z0-9_:\u4e00-\u9fa5\u00C0-\u017F]
2608+
column_part = [A-Za-z0-9_:\u4e00-\u9fa5\u00C0-\u017F\u0080-\u00FF]
26092609

26102610
param
26112611
= l:(':' ident_name) {

test/transactsql.spec.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ describe('transactsql', () => {
306306
expect(getParsedSql(sql)).to.be.equal(`SELECT [column_name] FROM [table_name] FOR XML PATH`)
307307
sql = 'SELECT column_name FROM table_name FOR JSON PATH';
308308
expect(getParsedSql(sql)).to.be.equal(`SELECT [column_name] FROM [table_name] FOR JSON PATH`)
309-
309+
310310
})
311311
it('should support cross and outer apply', () => {
312312
const applies = ['cross', 'outer']
@@ -485,6 +485,15 @@ describe('transactsql', () => {
485485
'CREATE TABLE [dbo].[Ordine] ([NoteInvioEmail] NTEXT)'
486486
]
487487
},
488+
{
489+
title: 'Latin-1 Supplement as part of column name',
490+
sql: [
491+
`SELECT YEAR(DateTime) AS Year, FLOOR(Thickness_Avg/100.0) * 100 AS Thickness_Group_µm, COUNT(DISTINCT Coil_ID) AS Coil_Count
492+
FROM ValuesHSM_ExitIMS_PG WHERE Coil_ID IS NOT NULL GROUP BY YEAR(DateTime), FLOOR(Thickness_Avg/100.0) * 100
493+
ORDER BY Year, Thickness_Group_µm`,
494+
'SELECT YEAR([DateTime]) AS [Year], FLOOR([Thickness_Avg] / 100.0) * 100 AS [Thickness_Group_µm], COUNT(DISTINCT [Coil_ID]) AS [Coil_Count] FROM [ValuesHSM_ExitIMS_PG] WHERE [Coil_ID] IS NOT NULL GROUP BY YEAR([DateTime]), FLOOR([Thickness_Avg] / 100.0) * 100 ORDER BY [Year] ASC, [Thickness_Group_µm] ASC'
495+
]
496+
},
488497
]
489498
SQL_LIST.forEach(sqlInfo => {
490499
const { title, sql } = sqlInfo
@@ -493,4 +502,3 @@ describe('transactsql', () => {
493502
})
494503
})
495504
})
496-

0 commit comments

Comments
 (0)