diff options
author | marsaly <marsaly@ydb.tech> | 2023-12-16 17:46:46 +0300 |
---|---|---|
committer | marsaly <marsaly@ydb.tech> | 2023-12-16 18:16:17 +0300 |
commit | ca90bd139012a835dc44ccddbf8d122ee84eec3c (patch) | |
tree | e7eac13b6f9a5beee4b97e74c98d46dcd2362828 | |
parent | 0cbd0cffa5f7ac88780b91e95524bed4010f725c (diff) | |
download | ydb-ca90bd139012a835dc44ccddbf8d122ee84eec3c.tar.gz |
Support \pset null in pgrun
Added \pset null support in pgrun
-rw-r--r-- | ydb/library/yql/tests/postgresql/cases/boolean.err | 1 | ||||
-rw-r--r-- | ydb/library/yql/tests/postgresql/cases/boolean.out | 40 | ||||
-rw-r--r-- | ydb/library/yql/tests/postgresql/cases/boolean.sql | 10 | ||||
-rw-r--r-- | ydb/library/yql/tests/postgresql/cases/jsonb.out | 2 | ||||
-rw-r--r-- | ydb/library/yql/tests/postgresql/cases/jsonb.sql | 2 | ||||
-rw-r--r-- | ydb/library/yql/tests/postgresql/pg_tests.csv | 22 | ||||
-rw-r--r-- | ydb/library/yql/tests/postgresql/status.md | 6 | ||||
-rw-r--r-- | ydb/library/yql/tests/postgresql/status.old | 56 | ||||
-rw-r--r-- | ydb/library/yql/tools/pgrun/pgrun.cpp | 30 |
9 files changed, 125 insertions, 44 deletions
diff --git a/ydb/library/yql/tests/postgresql/cases/boolean.err b/ydb/library/yql/tests/postgresql/cases/boolean.err index a87bde6cad..08d82b2a78 100644 --- a/ydb/library/yql/tests/postgresql/cases/boolean.err +++ b/ydb/library/yql/tests/postgresql/cases/boolean.err @@ -491,7 +491,6 @@ INSERT INTO booltbl4 VALUES (false, true, null); <sql-statement> \pset null '(null)' </sql-statement> -Metacommand \pset null '(null)' is not supported <sql-statement> -- AND expression need to return null if there's any nulls and not all -- of the value are true diff --git a/ydb/library/yql/tests/postgresql/cases/boolean.out b/ydb/library/yql/tests/postgresql/cases/boolean.out index a95d897d37..81a6fd9696 100644 --- a/ydb/library/yql/tests/postgresql/cases/boolean.out +++ b/ydb/library/yql/tests/postgresql/cases/boolean.out @@ -305,6 +305,46 @@ INSERT INTO BOOLTBL3 (d, b, o) VALUES ('null', null, 3); CREATE TABLE booltbl4(isfalse bool, istrue bool, isnul bool); INSERT INTO booltbl4 VALUES (false, true, null); \pset null '(null)' +-- AND expression need to return null if there's any nulls and not all +-- of the value are true +SELECT istrue AND isnul AND istrue FROM booltbl4; + ?column? +---------- + (null) +(1 row) + +SELECT istrue AND istrue AND isnul FROM booltbl4; + ?column? +---------- + (null) +(1 row) + +SELECT isnul AND istrue AND istrue FROM booltbl4; + ?column? +---------- + (null) +(1 row) + +-- OR expression need to return null if there's any nulls and none +-- of the value is true +SELECT isfalse OR isnul OR isfalse FROM booltbl4; + ?column? +---------- + (null) +(1 row) + +SELECT isfalse OR isfalse OR isnul FROM booltbl4; + ?column? +---------- + (null) +(1 row) + +SELECT isnul OR isfalse OR isfalse FROM booltbl4; + ?column? +---------- + (null) +(1 row) + -- -- Clean up -- Many tables are retained by the regression test, but these do not seem diff --git a/ydb/library/yql/tests/postgresql/cases/boolean.sql b/ydb/library/yql/tests/postgresql/cases/boolean.sql index 3be5e93776..705e5a5c31 100644 --- a/ydb/library/yql/tests/postgresql/cases/boolean.sql +++ b/ydb/library/yql/tests/postgresql/cases/boolean.sql @@ -92,6 +92,16 @@ INSERT INTO BOOLTBL3 (d, b, o) VALUES ('null', null, 3); CREATE TABLE booltbl4(isfalse bool, istrue bool, isnul bool); INSERT INTO booltbl4 VALUES (false, true, null); \pset null '(null)' +-- AND expression need to return null if there's any nulls and not all +-- of the value are true +SELECT istrue AND isnul AND istrue FROM booltbl4; +SELECT istrue AND istrue AND isnul FROM booltbl4; +SELECT isnul AND istrue AND istrue FROM booltbl4; +-- OR expression need to return null if there's any nulls and none +-- of the value is true +SELECT isfalse OR isnul OR isfalse FROM booltbl4; +SELECT isfalse OR isfalse OR isnul FROM booltbl4; +SELECT isnul OR isfalse OR isfalse FROM booltbl4; -- -- Clean up -- Many tables are retained by the regression test, but these do not seem diff --git a/ydb/library/yql/tests/postgresql/cases/jsonb.out b/ydb/library/yql/tests/postgresql/cases/jsonb.out index 26179b9018..eb0e6281b0 100644 --- a/ydb/library/yql/tests/postgresql/cases/jsonb.out +++ b/ydb/library/yql/tests/postgresql/cases/jsonb.out @@ -1919,6 +1919,8 @@ select jsonb_set('[{"f1":1,"f2":null},2,null,3]', '{0}','[2,3,4]', false); [[2, 3, 4], 2, null, 3] (1 row) +-- jsonb_set_lax +\pset null NULL -- errors select jsonb_set_lax('{"a":1,"b":2}', '{b}', null, true, null); ERROR: null_value_treatment must be "delete_key", "return_target", "use_json_null", or "raise_exception" diff --git a/ydb/library/yql/tests/postgresql/cases/jsonb.sql b/ydb/library/yql/tests/postgresql/cases/jsonb.sql index 845e2adbfc..d497888782 100644 --- a/ydb/library/yql/tests/postgresql/cases/jsonb.sql +++ b/ydb/library/yql/tests/postgresql/cases/jsonb.sql @@ -403,6 +403,8 @@ select '[]'::jsonb #- '{a}'; select jsonb_set('{}','{a}','"b"', false); select jsonb_set('[]','{1}','"b"', false); select jsonb_set('[{"f1":1,"f2":null},2,null,3]', '{0}','[2,3,4]', false); +-- jsonb_set_lax +\pset null NULL -- errors select jsonb_set_lax('{"a":1,"b":2}', '{b}', null, true, null); select jsonb_set_lax('{"a":1,"b":2}', '{b}', null, true, 'no_such_treatment'); diff --git a/ydb/library/yql/tests/postgresql/pg_tests.csv b/ydb/library/yql/tests/postgresql/pg_tests.csv index b363fc4fa6..044ac5c195 100644 --- a/ydb/library/yql/tests/postgresql/pg_tests.csv +++ b/ydb/library/yql/tests/postgresql/pg_tests.csv @@ -5,45 +5,45 @@ expressions,63,14,22.22 dbsize,24,24,100.0
create_table,368,43,11.68
create_misc,76,3,3.95
+json_encoding,42,42,100.0
alter_table,1679,11,0.66
insert,357,15,4.2
-json_encoding,42,42,100.0
jsonpath_encoding,31,31,100.0
+jsonb_jsonpath,427,88,20.61
horology,306,79,25.82
limit,84,5,5.95
-jsonb_jsonpath,427,88,20.61
numerology,24,8,33.33
jsonpath,169,152,89.94
delete,10,0,0.0
select_distinct,46,1,2.17
select_distinct_on,4,0,0.0
date,264,200,75.76
-case,63,29,46.03
name,40,22,55.0
+case,63,29,46.03
select_into,67,3,4.48
strings,390,31,7.95
oid,27,21,77.78
-text,76,15,19.74
select,88,9,10.23
-float4,96,48,50.0
+text,76,15,19.74
interval,168,115,68.45
+float4,96,48,50.0
subselect,234,2,0.85
-boolean,93,67,72.04
+boolean,93,73,78.49
unicode,13,4,30.77
-time,39,33,84.62
int2,49,47,95.92
bit,115,84,73.04
-union,186,0,0.0
+time,39,33,84.62
int4,70,70,100.0
+union,186,0,0.0
float8,168,96,57.14
timetz,45,29,64.44
-update,288,22,7.64
json,454,115,25.33
+update,288,22,7.64
truncate,193,33,17.1
-arrays,410,119,29.02
window,298,5,1.68
+arrays,410,119,29.02
aggregates,416,51,12.26
-jsonb,1017,381,37.46
+jsonb,1017,382,37.56
timestamp,145,98,67.59
int8,142,48,33.8
timestamptz,315,108,34.29
diff --git a/ydb/library/yql/tests/postgresql/status.md b/ydb/library/yql/tests/postgresql/status.md index 8da5ecf2d5..25d51f45d4 100644 --- a/ydb/library/yql/tests/postgresql/status.md +++ b/ydb/library/yql/tests/postgresql/status.md @@ -2,7 +2,7 @@ #| ||№ п/п | Имя теста|Число операторов| Из них выполняется| % выполнения | Последнее обновление | Основные проблемы || -|| 1 | boolean | 93 | 67 (+3) | 72.04 | 12.12.2023 | DROP TABLE, implicit casts, \pset (null) || +|| 1 | boolean | 93 | 73 (+6) | 78.49 | 16.12.2023 | DROP TABLE, implicit casts || || 2 | char | 25 | 3 | 12.0 | 25.05.2023 | implicit cast, pgbpchar vs pgtext || || 3 | name | 40 | 22 (+17) | 55.0 | 29.09.2023 | parse_ident, implicit casts || || 4 | varchar | 24 | 2 | 8.33 | 25.05.2023 | || @@ -16,7 +16,7 @@ || 12 | bit | 115 | 84 (+80) | 73.04 | 12.12.2023 | substring, COPY FROM stdin, битовые константы || || 13 | numeric | 915 | 715 (+189) | 78.14 | 12.12.2023 | CREATE UNIQUE INDEX, VACUUM ANALYZE, implicit casts, ошибочно проходит cast в int2 и int8, форматирование NaN и Infinity, COPY FROM stdin, SET lc_numeric, умножение больших целых чисел не дает в результате число с плавающей точкой, sum(), округление, nullif, форматирование чисел || || 14 | uuid | 36 | 0 | 0.0 | 02.05.2023 | ||· -|| 15 | strings | 390 | 31 (+3) | 7.95 | 25.08.2023 | SET, RESET, standard_conforming_strings, bytea_output, \pset, неинициализированная поддержка регулярок, pg_class || +|| 15 | strings | 390 | 31 (+3) | 7.95 | 25.08.2023 | SET, RESET, standard_conforming_strings, bytea_output, неинициализированная поддержка регулярок, pg_class || || 16 | numerology | 24 | 8 (+4) | 33.33 | 26.07.2023 | || || 17 | date | 264 | 200 (+183) | 75.76 | 12.12.2023 | || || 18 | time | 39 | 33 (+22) | 84.62 | 12.12.2023 | || @@ -49,7 +49,7 @@ || 45 | window | 298 | 5 (+3) | 1.68 | 12.12.2023 | || || 46 | functional_deps | 40 | 6 (+2) | 15.0 | 12.12.2023 | || || 47 | json | 454 | 115 (+64) | 25.33 | 12.12.2023 | || -|| 48 | jsonb | 1017 | 381 (+331) | 37.46 | 12.12.2023 | || +|| 48 | jsonb | 1017 | 382 (+1) | 37.56 | 16.12.2023 | || || 49 | json_encoding | 42 | 42 | 100.0 | 29.05.2023 | || || 50 | jsonpath | 169 | 152 | 89.94 | 29.05.2023 | числа с точкой без целой части (например .1), литерал '00' || || 51 | jsonpath_encoding | 31 | 31 | 100.0 | 29.05.2023 | || diff --git a/ydb/library/yql/tests/postgresql/status.old b/ydb/library/yql/tests/postgresql/status.old index 5603c33126..8da5ecf2d5 100644 --- a/ydb/library/yql/tests/postgresql/status.old +++ b/ydb/library/yql/tests/postgresql/status.old @@ -2,60 +2,60 @@ #| ||№ п/п | Имя теста|Число операторов| Из них выполняется| % выполнения | Последнее обновление | Основные проблемы || -|| 1 | boolean | 93 | 64 (+1) | 68.82 | 29.09.2023 | DROP TABLE, implicit casts, \pset (null) || +|| 1 | boolean | 93 | 67 (+3) | 72.04 | 12.12.2023 | DROP TABLE, implicit casts, \pset (null) || || 2 | char | 25 | 3 | 12.0 | 25.05.2023 | implicit cast, pgbpchar vs pgtext || || 3 | name | 40 | 22 (+17) | 55.0 | 29.09.2023 | parse_ident, implicit casts || || 4 | varchar | 24 | 2 | 8.33 | 25.05.2023 | || -|| 5 | text | 76 | 5 | 6.58 | 25.05.2023 | строковые функции (format, concat, concat_ws, length) и оператор конкатенации, implicit casts, отличаются сообщения об ошибках для оператора конкатенации с аргументами неподходящих типов || +|| 5 | text | 76 | 15 (+10) | 19.74 | 12.12.2023 | строковые функции (format, concat, concat_ws, length) и оператор конкатенации, implicit casts, отличаются сообщения об ошибках для оператора конкатенации с аргументами неподходящих типов || || 6 | int2 | 49 | 47 (+39) | 95.92 | 29.09.2023 | || || 7 | int4 | 70 | 70 (+42) | 100.0 | 29.09.2023 | || -|| 8 | int8 | 142 | 13 (+7) | 9.15 | 29.09.2023 | generate_series, pg_type, gcd, implicit casts || +|| 8 | int8 | 142 | 48 (+35) | 33.8 | 12.12.2023 | generate_series, pg_type, gcd, implicit casts || || 9 | oid | 27 | 21 (+19) | 77.78 | 29.09.2023 | || || 10 | float4 | 96 | 48 (+31) | 50.0 | 29.09.2023 | CREATE TYPE, CREATE FUNCTION, WITH, форматирование NaN и Infinity, float4send || || 11 | float8 | 168 | 96 (+1) | 57.14 | 25.10.2023 | CREATE CAST, форматирование NaN и Infinity, extra_float_digits, implicit casts, float8send || -|| 12 | bit | 115 | 4 (+4) | 3.48 | 25.10.2023 | substring, COPY FROM stdin, битовые константы || -|| 13 | numeric | 915 | 526 (+23) | 57.49 | 10.08.2023 | CREATE UNIQUE INDEX, VACUUM ANALYZE, implicit casts, ошибочно проходит cast в int2 и int8, форматирование NaN и Infinity, COPY FROM stdin, SET lc_numeric, умножение больших целых чисел не дает в результате число с плавающей точкой, sum(), округление, nullif, форматирование чисел || +|| 12 | bit | 115 | 84 (+80) | 73.04 | 12.12.2023 | substring, COPY FROM stdin, битовые константы || +|| 13 | numeric | 915 | 715 (+189) | 78.14 | 12.12.2023 | CREATE UNIQUE INDEX, VACUUM ANALYZE, implicit casts, ошибочно проходит cast в int2 и int8, форматирование NaN и Infinity, COPY FROM stdin, SET lc_numeric, умножение больших целых чисел не дает в результате число с плавающей точкой, sum(), округление, nullif, форматирование чисел || || 14 | uuid | 36 | 0 | 0.0 | 02.05.2023 | ||· || 15 | strings | 390 | 31 (+3) | 7.95 | 25.08.2023 | SET, RESET, standard_conforming_strings, bytea_output, \pset, неинициализированная поддержка регулярок, pg_class || || 16 | numerology | 24 | 8 (+4) | 33.33 | 26.07.2023 | || -|| 17 | date | 264 | 17 | 6.44 | 25.05.2023 | || -|| 18 | time | 39 | 11 | 28.21 | 25.05.2023 | || -|| 19 | timetz | 45 | 13 | 28.89 | 25.05.2023 | || -|| 20 | timestamp | 145 | 81 (+3) | 55.86 | 10.08.2023 | || -|| 21 | timestamptz | 315 | 83 (+4) | 26.35 | 10.08.2023 | || +|| 17 | date | 264 | 200 (+183) | 75.76 | 12.12.2023 | || +|| 18 | time | 39 | 33 (+22) | 84.62 | 12.12.2023 | || +|| 19 | timetz | 45 | 29 (+16) | 64.44 | 12.12.2023 | || +|| 20 | timestamp | 145 | 98 (+17) | 67.59 | 12.12.2023 | || +|| 21 | timestamptz | 315 | 108 (+25) | 34.29 | 12.12.2023 | || || 22 | interval | 168 | 115 (+1) | 68.45 | 25.10.2023 | || || 23 | horology | 306 | 79 (+28) | 25.82 | 10.08.2023 | SET, DateStyle, TimeZone, автоматически назначаемые имена колонкам-выражениям, SET TIME ZOME, RESET TIME ZONE, интервальный тип ПГ, || || 24 | comments | 7 | 7 | 100.0 | 25.05.2023 | || || 25 | expressions | 63 | 14 (+4) | 22.22 | 25.10.2023 | || || 26 | unicode | 13 | 4 (+4) | 30.77 | 10.08.2023 | || -|| 27 | create_table | 368 | 47 (+1) | 12.77 | 25.10.2023 | CREATE UNLOGGED TABLE, REINDEX, PREPARE ... SELECT, DEALLOCATE, \gexec, pg_class, pg_attribute, CREATE TABLE PARTITION OF || -|| 28 | insert | 357 | 10 (+10) | 2.8 | 25.10.2023 | CREATE TEMP TABLE, ALTER TABLE, DROP TABLE, CREATE TYPE, CREATE RULE, \d+, DROP TYPE, create table...partition by range, create table ... partition of ..., tableoid::regclass, create or replace function, create operator, || +|| 27 | create_table | 368 | 43 | 11.68 | 12.12.2023 | CREATE UNLOGGED TABLE, REINDEX, PREPARE ... SELECT, DEALLOCATE, \gexec, pg_class, pg_attribute, CREATE TABLE PARTITION OF || +|| 28 | insert | 357 | 15 (+5) | 4.2 | 12.12.2023 | CREATE TEMP TABLE, ALTER TABLE, DROP TABLE, CREATE TYPE, CREATE RULE, \d+, DROP TYPE, create table...partition by range, create table ... partition of ..., tableoid::regclass, create or replace function, create operator, || || 29 | create_misc | 76 | 3 (+2) | 3.95 | 29.09.2023 | || -|| 30 | select | 88 | 4 (+4) | 4.55 | 25.10.2023 | порядок сортировки в виде ORDER BY поле using > или <, а также NULLS FIRST/LAST; ANALYZE, переменные enable_seqscan, enable_bitmapscan, enable_sort, whole-row Var referencing a subquery, подзапросы внутри values, INSERT INTO ... DEFAULT VALUES, Range sub select unsupported lateral, CREATE INDEX, DROP INDEX, explain (опции costs, analyze, timing, summary), SELECT 1 AS x ORDER BY x; CREATE FUNCTION, DROP FUNCTION, table inheritance, PARTITION BY || +|| 30 | select | 88 | 9 (+5) | 10.23 | 12.12.2023 | порядок сортировки в виде ORDER BY поле using > или <, а также NULLS FIRST/LAST; ANALYZE, переменные enable_seqscan, enable_bitmapscan, enable_sort, whole-row Var referencing a subquery, подзапросы внутри values, INSERT INTO ... DEFAULT VALUES, Range sub select unsupported lateral, CREATE INDEX, DROP INDEX, explain (опции costs, analyze, timing, summary), SELECT 1 AS x ORDER BY x; CREATE FUNCTION, DROP FUNCTION, table inheritance, PARTITION BY || || 31 | select_into | 67 | 3 | 4.48 | 27.07.2023 | || || 32 | select_distinct | 46 | 1 | 2.17 | 27.07.2023 | || || 33 | select_distinct_on | 4 | 0 | 0.0 | 25.05.2023 | || -|| 34 | select_implicit | 44 | 11 | 25.0 | 25.05.2023 | || -|| 35 | select_having | 23 | 11 | 47.83 | 25.05.2023 | || +|| 34 | select_implicit | 44 | 13 (+2) | 29.55 | 12.12.2023 | || +|| 35 | select_having | 23 | 16 (+5) | 69.57 | 12.12.2023 | || || 36 | subselect | 234 | 2 | 0.85 | 25.05.2023 | || || 37 | union | 186 | 0 | 0.0 | 25.05.2023 | || -|| 38 | case | 63 | 13 | 20.63 | 25.05.2023 | implicit casts, create function volatile || -|| 39 | join | 591 | 23 (+1) | 3.89 | 14.06.2023 | || -|| 40 | aggregates | 416 | 1 (+1) | 0.24 | 25.08.2023 | || -|| 41 | arrays | 410 | 1 | 0.24 | 29.09.2023 | || -|| 42 | update | 288 | 17 | 5.9 | 27.07.2023 | :-переменные || +|| 38 | case | 63 | 29 (+16) | 46.03 | 12.12.2023 | implicit casts, create function volatile || +|| 39 | join | 591 | 106 (+83) | 17.94 | 12.12.2023 | || +|| 40 | aggregates | 416 | 51 (+50) | 12.26 | 12.12.2023 | || +|| 41 | arrays | 410 | 119 (+118) | 29.02 | 12.12.2023 | || +|| 42 | update | 288 | 22 (+5) | 7.64 | 12.12.2023 | :-переменные || || 43 | delete | 10 | 0 | 0.0 | 25.05.2023 | || || 44 | dbsize | 24 | 24 (+16) | 100.0 | 10.08.2023 | || -|| 45 | window | 298 | 2 (+2) | 0.67 | 14.06.2023 | || -|| 46 | functional_deps | 40 | 4 (+1) | 10.0 | 29.09.2023 | || -|| 47 | json | 454 | 51 (+1) | 11.23 | 25.10.2023 | || -|| 48 | jsonb | 1017 | 50 (+1) | 4.92 | 25.10.2023 | || +|| 45 | window | 298 | 5 (+3) | 1.68 | 12.12.2023 | || +|| 46 | functional_deps | 40 | 6 (+2) | 15.0 | 12.12.2023 | || +|| 47 | json | 454 | 115 (+64) | 25.33 | 12.12.2023 | || +|| 48 | jsonb | 1017 | 381 (+331) | 37.46 | 12.12.2023 | || || 49 | json_encoding | 42 | 42 | 100.0 | 29.05.2023 | || || 50 | jsonpath | 169 | 152 | 89.94 | 29.05.2023 | числа с точкой без целой части (например .1), литерал '00' || || 51 | jsonpath_encoding | 31 | 31 | 100.0 | 29.05.2023 | || -|| 52 | jsonb_jsonpath | 427 | 5 (+5) | 1.17 | 27.07.2023 | || +|| 52 | jsonb_jsonpath | 427 | 88 (+83) | 20.61 | 12.12.2023 | || || 53 | limit | 84 | 5 (+4) | 5.95 | 10.08.2023 | || -|| 54 | truncate | 193 | 3 | 1.55 | 25.05.2023 | || -|| 55 | alter_table | 1679 | 4 (+2) | 0.24 | 25.08.2023 | COMMENT ON TABLE || -|| 56 | xml | 234 | 3 | 1.28 | 25.05.2023 | \set VERBOSITY || +|| 54 | truncate | 193 | 33 (+30) | 17.1 | 12.12.2023 | || +|| 55 | alter_table | 1679 | 11 (+7) | 0.66 | 12.12.2023 | COMMENT ON TABLE || +|| 56 | xml | 234 | 15 (+12) | 6.41 | 12.12.2023 | \set VERBOSITY || |# diff --git a/ydb/library/yql/tools/pgrun/pgrun.cpp b/ydb/library/yql/tools/pgrun/pgrun.cpp index 7199f25293..a26b41ddac 100644 --- a/ydb/library/yql/tools/pgrun/pgrun.cpp +++ b/ydb/library/yql/tools/pgrun/pgrun.cpp @@ -38,7 +38,7 @@ namespace NMiniKQL = NKikimr::NMiniKQL; const ui32 PRETTY_FLAGS = NYql::TAstPrintFlags::PerLine | NYql::TAstPrintFlags::ShortQuote | NYql::TAstPrintFlags::AdaptArbitraryContent; -const TString nullRepr(""); +TString nullRepr(""); bool IsEscapedChar(const TString& s, size_t pos) { bool escaped = false; @@ -937,6 +937,25 @@ void WriteToYtTableScheme( } void ProcessMetaCmd(const TStringBuf& cmd) { + const TStringBuf pset_null("\\pset null "); + + if (cmd.starts_with(pset_null)) { + const auto secondArgPos = cmd.find_first_not_of(" ", pset_null.length()); + if (secondArgPos != std::string_view::npos) { + TStringBuf newNullRepr(cmd, secondArgPos); + + if (newNullRepr.front() == '\'') { + newNullRepr.remove_prefix(1); + + if (newNullRepr.back() == '\'') { + newNullRepr.remove_suffix(1); + } + } + nullRepr = newNullRepr; + + return; + } + } Cerr << "Metacommand " << cmd << " is not supported\n"; } @@ -1003,6 +1022,15 @@ int Main(int argc, char* argv[]) continue; } + { + const auto metaCmdStart = stmt.find("\n\\"); + if (TString::npos != metaCmdStart) { + const auto metaCmdEnd = stmt.find_first_of("\r\n", metaCmdStart + 2); + ProcessMetaCmd(stmt.substr(metaCmdStart + 1, metaCmdEnd)); + continue; + } + } + google::protobuf::Arena arena; NSQLTranslation::TTranslationSettings settings; settings.Arena = &arena; |