PostgreSQL - 在列别名中转义单引号
PostgreSQL - Escape single quote in an column alias
如何在 PostgreSQL 的列别名中转义单引号?
我尝试了几种语法都没有成功:
SELECT 'Test 1' AS 'O''Connell';
SELECT 'Test 2' AS 'O\'Connell';
SELECT 'Test 3' AS "O''Connell";
PgAdmin 截图
标识符使用双引号,内部使用单引号:
SELECT 'Test 3' AS "O'Connell";
O'Connell
-----------
Test 3
如何在 PostgreSQL 的列别名中转义单引号?
我尝试了几种语法都没有成功:
SELECT 'Test 1' AS 'O''Connell';
SELECT 'Test 2' AS 'O\'Connell';
SELECT 'Test 3' AS "O''Connell";
PgAdmin 截图
标识符使用双引号,内部使用单引号:
SELECT 'Test 3' AS "O'Connell";
O'Connell
-----------
Test 3