diff --git a/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp b/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
index e9c2cf1872ec..b2d927ccfc8f 100644
--- a/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
+++ b/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
@@ -87,6 +87,7 @@ static __thread bool NeedCanonizeFp = false;
struct TMainContext {
MemoryContextData Data;
+ MemoryContextData ErrorData;
MemoryContext PrevCurrentMemoryContext = nullptr;
MemoryContext PrevErrorContext = nullptr;
MemoryContext PrevCacheMemoryContext = nullptr;
@@ -3864,6 +3865,11 @@ void* PgInitializeMainContext() {
&MkqlMethods,
nullptr,
"mkql");
+ MemoryContextCreate((MemoryContext)&ctx->ErrorData,
+ T_AllocSetContext,
+ &MkqlMethods,
+ nullptr,
+ "mkql-err");
ctx->StartTimestamp = GetCurrentTimestamp();
return ctx;
}
@@ -3881,7 +3887,8 @@ void PgAcquireThreadContext(void* ctx) {
main->PrevCacheMemoryContext = CacheMemoryContext;
SaveRecordCacheState(&main->PrevRecordCacheState);
LoadRecordCacheState(&main->CurrentRecordCacheState);
- CurrentMemoryContext = ErrorContext = CacheMemoryContext = (MemoryContext)&main->Data;
+ CurrentMemoryContext = CacheMemoryContext = (MemoryContext)&main->Data;
+ ErrorContext = (MemoryContext)&main->ErrorData;
SetParallelStartTimestamps(main->StartTimestamp, main->StartTimestamp);
main->PrevStackBase = set_stack_base();
yql_error_report_active = true;
diff --git a/ydb/library/yql/tests/postgresql/cases/int8.err b/ydb/library/yql/tests/postgresql/cases/int8.err
index a05a97aeee0e..8261b1858b44 100644
--- a/ydb/library/yql/tests/postgresql/cases/int8.err
+++ b/ydb/library/yql/tests/postgresql/cases/int8.err
@@ -735,6 +735,183 @@ SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::in
SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8, 2);
-pgrun: /-S/ydbwork/ydb/ydb/contrib/libs/llvm12/lib/IR/LegacyPassManager.cpp:588: void llvm::PMTopLevelManager::setLastUser(ArrayRef, Pass *): Assertion `AnalysisPass && "Expected analysis pass to exist."' failed.
-pthread_kill at ./nptl/./nptl/pthread_kill.c:43:17
-?? at ??:0:0
+
+-- corner case
+SELECT (-1::int8<<63)::text;
+
+
+SELECT ((-1::int8<<63)+1)::text;
+
+
+-- check sane handling of INT64_MIN overflow cases
+SELECT (-9223372036854775808)::int8 * (-1)::int8;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ -- check sane handling of INT64_MIN overflow cases
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ -- check sane handling of INT64_MIN overflow cases
+ ^
+
+SELECT (-9223372036854775808)::int8 / (-1)::int8;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT (-9223372036854775808)::int8 / (-1)::int8;
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ SELECT (-9223372036854775808)::int8 / (-1)::int8;
+ ^
+
+SELECT (-9223372036854775808)::int8 % (-1)::int8;
+
+
+SELECT (-9223372036854775808)::int8 * (-1)::int4;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT (-9223372036854775808)::int8 * (-1)::int4;
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ SELECT (-9223372036854775808)::int8 * (-1)::int4;
+ ^
+
+SELECT (-9223372036854775808)::int8 / (-1)::int4;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT (-9223372036854775808)::int8 / (-1)::int4;
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ SELECT (-9223372036854775808)::int8 / (-1)::int4;
+ ^
+
+SELECT (-9223372036854775808)::int8 % (-1)::int4;
+
+
+SELECT (-9223372036854775808)::int8 * (-1)::int2;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT (-9223372036854775808)::int8 * (-1)::int2;
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ SELECT (-9223372036854775808)::int8 * (-1)::int2;
+ ^
+
+SELECT (-9223372036854775808)::int8 / (-1)::int2;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT (-9223372036854775808)::int8 / (-1)::int2;
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ SELECT (-9223372036854775808)::int8 / (-1)::int2;
+ ^
+
+SELECT (-9223372036854775808)::int8 % (-1)::int2;
+
+
+-- check rounding when casting from float
+SELECT x, x::int8 AS int8_value
+FROM (VALUES (-2.5::float8),
+ (-1.5::float8),
+ (-0.5::float8),
+ (0.0::float8),
+ (0.5::float8),
+ (1.5::float8),
+ (2.5::float8)) t(x);
+
+
+-- check rounding when casting from numeric
+SELECT x, x::int8 AS int8_value
+FROM (VALUES (-2.5::numeric),
+ (-1.5::numeric),
+ (-0.5::numeric),
+ (0.0::numeric),
+ (0.5::numeric),
+ (1.5::numeric),
+ (2.5::numeric)) t(x);
+
+
+-- test gcd()
+SELECT a, b, gcd(a, b), gcd(a, -b), gcd(b, a), gcd(-b, a)
+FROM (VALUES (0::int8, 0::int8),
+ (0::int8, 29893644334::int8),
+ (288484263558::int8, 29893644334::int8),
+ (-288484263558::int8, 29893644334::int8),
+ ((-9223372036854775808)::int8, 1::int8),
+ ((-9223372036854775808)::int8, 9223372036854775807::int8),
+ ((-9223372036854775808)::int8, 4611686018427387904::int8)) AS v(a, b);
+
+
+SELECT gcd((-9223372036854775808)::int8, 0::int8); -- overflow
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT gcd((-9223372036854775808)::int8, 0::int8); -- overflow
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ SELECT gcd((-9223372036854775808)::int8, 0::int8); -- overflow
+ ^
+
+SELECT gcd((-9223372036854775808)::int8, (-9223372036854775808)::int8); -- overflow
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT gcd((-9223372036854775808)::int8, (-9223372036854775808)::int8); -- overflow
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ SELECT gcd((-9223372036854775808)::int8, (-9223372036854775808)::int8); -- overflow
+ ^
+
+-- test lcm()
+SELECT a, b, lcm(a, b), lcm(a, -b), lcm(b, a), lcm(-b, a)
+FROM (VALUES (0::int8, 0::int8),
+ (0::int8, 29893644334::int8),
+ (29893644334::int8, 29893644334::int8),
+ (288484263558::int8, 29893644334::int8),
+ (-288484263558::int8, 29893644334::int8),
+ ((-9223372036854775808)::int8, 0::int8)) AS v(a, b);
+
+
+SELECT lcm((-9223372036854775808)::int8, 1::int8); -- overflow
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT lcm((-9223372036854775808)::int8, 1::int8); -- overflow
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ SELECT lcm((-9223372036854775808)::int8, 1::int8); -- overflow
+ ^
+
+SELECT lcm(9223372036854775807::int8, 9223372036854775806::int8); -- overflow
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT lcm(9223372036854775807::int8, 9223372036854775806::int8); -- overflow
+ ^
+ -stdin-::1:1: Fatal: ERROR: bigint out of range
+
+ SELECT lcm(9223372036854775807::int8, 9223372036854775806::int8); -- overflow
+ ^
diff --git a/ydb/library/yql/tests/postgresql/cases/int8.out b/ydb/library/yql/tests/postgresql/cases/int8.out
index ed3019fa2e34..93586ad85e60 100644
--- a/ydb/library/yql/tests/postgresql/cases/int8.out
+++ b/ydb/library/yql/tests/postgresql/cases/int8.out
@@ -737,3 +737,146 @@ SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::in
4567890123456799
(11 rows)
+SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8, 0);
+ERROR: step size cannot equal zero
+SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8, 2);
+ generate_series
+------------------
+ 4567890123456789
+ 4567890123456791
+ 4567890123456793
+ 4567890123456795
+ 4567890123456797
+ 4567890123456799
+(6 rows)
+
+-- corner case
+SELECT (-1::int8<<63)::text;
+ text
+----------------------
+ -9223372036854775808
+(1 row)
+
+SELECT ((-1::int8<<63)+1)::text;
+ text
+----------------------
+ -9223372036854775807
+(1 row)
+
+-- check sane handling of INT64_MIN overflow cases
+SELECT (-9223372036854775808)::int8 * (-1)::int8;
+ERROR: bigint out of range
+SELECT (-9223372036854775808)::int8 / (-1)::int8;
+ERROR: bigint out of range
+SELECT (-9223372036854775808)::int8 % (-1)::int8;
+ ?column?
+----------
+ 0
+(1 row)
+
+SELECT (-9223372036854775808)::int8 * (-1)::int4;
+ERROR: bigint out of range
+SELECT (-9223372036854775808)::int8 / (-1)::int4;
+ERROR: bigint out of range
+SELECT (-9223372036854775808)::int8 % (-1)::int4;
+ ?column?
+----------
+ 0
+(1 row)
+
+SELECT (-9223372036854775808)::int8 * (-1)::int2;
+ERROR: bigint out of range
+SELECT (-9223372036854775808)::int8 / (-1)::int2;
+ERROR: bigint out of range
+SELECT (-9223372036854775808)::int8 % (-1)::int2;
+ ?column?
+----------
+ 0
+(1 row)
+
+-- check rounding when casting from float
+SELECT x, x::int8 AS int8_value
+FROM (VALUES (-2.5::float8),
+ (-1.5::float8),
+ (-0.5::float8),
+ (0.0::float8),
+ (0.5::float8),
+ (1.5::float8),
+ (2.5::float8)) t(x);
+ x | int8_value
+------+------------
+ -2.5 | -2
+ -1.5 | -2
+ -0.5 | 0
+ 0 | 0
+ 0.5 | 0
+ 1.5 | 2
+ 2.5 | 2
+(7 rows)
+
+-- check rounding when casting from numeric
+SELECT x, x::int8 AS int8_value
+FROM (VALUES (-2.5::numeric),
+ (-1.5::numeric),
+ (-0.5::numeric),
+ (0.0::numeric),
+ (0.5::numeric),
+ (1.5::numeric),
+ (2.5::numeric)) t(x);
+ x | int8_value
+------+------------
+ -2.5 | -3
+ -1.5 | -2
+ -0.5 | -1
+ 0.0 | 0
+ 0.5 | 1
+ 1.5 | 2
+ 2.5 | 3
+(7 rows)
+
+-- test gcd()
+SELECT a, b, gcd(a, b), gcd(a, -b), gcd(b, a), gcd(-b, a)
+FROM (VALUES (0::int8, 0::int8),
+ (0::int8, 29893644334::int8),
+ (288484263558::int8, 29893644334::int8),
+ (-288484263558::int8, 29893644334::int8),
+ ((-9223372036854775808)::int8, 1::int8),
+ ((-9223372036854775808)::int8, 9223372036854775807::int8),
+ ((-9223372036854775808)::int8, 4611686018427387904::int8)) AS v(a, b);
+ a | b | gcd | gcd | gcd | gcd
+----------------------+---------------------+---------------------+---------------------+---------------------+---------------------
+ 0 | 0 | 0 | 0 | 0 | 0
+ 0 | 29893644334 | 29893644334 | 29893644334 | 29893644334 | 29893644334
+ 288484263558 | 29893644334 | 6835958 | 6835958 | 6835958 | 6835958
+ -288484263558 | 29893644334 | 6835958 | 6835958 | 6835958 | 6835958
+ -9223372036854775808 | 1 | 1 | 1 | 1 | 1
+ -9223372036854775808 | 9223372036854775807 | 1 | 1 | 1 | 1
+ -9223372036854775808 | 4611686018427387904 | 4611686018427387904 | 4611686018427387904 | 4611686018427387904 | 4611686018427387904
+(7 rows)
+
+SELECT gcd((-9223372036854775808)::int8, 0::int8); -- overflow
+ERROR: bigint out of range
+SELECT gcd((-9223372036854775808)::int8, (-9223372036854775808)::int8); -- overflow
+ERROR: bigint out of range
+-- test lcm()
+SELECT a, b, lcm(a, b), lcm(a, -b), lcm(b, a), lcm(-b, a)
+FROM (VALUES (0::int8, 0::int8),
+ (0::int8, 29893644334::int8),
+ (29893644334::int8, 29893644334::int8),
+ (288484263558::int8, 29893644334::int8),
+ (-288484263558::int8, 29893644334::int8),
+ ((-9223372036854775808)::int8, 0::int8)) AS v(a, b);
+ a | b | lcm | lcm | lcm | lcm
+----------------------+-------------+------------------+------------------+------------------+------------------
+ 0 | 0 | 0 | 0 | 0 | 0
+ 0 | 29893644334 | 0 | 0 | 0 | 0
+ 29893644334 | 29893644334 | 29893644334 | 29893644334 | 29893644334 | 29893644334
+ 288484263558 | 29893644334 | 1261541684539134 | 1261541684539134 | 1261541684539134 | 1261541684539134
+ -288484263558 | 29893644334 | 1261541684539134 | 1261541684539134 | 1261541684539134 | 1261541684539134
+ -9223372036854775808 | 0 | 0 | 0 | 0 | 0
+(6 rows)
+
+SELECT lcm((-9223372036854775808)::int8, 1::int8); -- overflow
+ERROR: bigint out of range
+SELECT lcm(9223372036854775807::int8, 9223372036854775806::int8); -- overflow
+ERROR: bigint out of range
diff --git a/ydb/library/yql/tests/postgresql/cases/int8.sql b/ydb/library/yql/tests/postgresql/cases/int8.sql
index 84bef05f5bc1..1b2d606bc051 100644
--- a/ydb/library/yql/tests/postgresql/cases/int8.sql
+++ b/ydb/library/yql/tests/postgresql/cases/int8.sql
@@ -135,3 +135,57 @@ SELECT q1, q2, q1 & q2 AS "and", q1 | q2 AS "or", q1 # q2 AS "xor", ~q1 AS "not"
SELECT q1, q1 << 2 AS "shl", q1 >> 3 AS "shr" FROM INT8_TBL;
-- generate_series
SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8);
+SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8, 0);
+SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8, 2);
+-- corner case
+SELECT (-1::int8<<63)::text;
+SELECT ((-1::int8<<63)+1)::text;
+-- check sane handling of INT64_MIN overflow cases
+SELECT (-9223372036854775808)::int8 * (-1)::int8;
+SELECT (-9223372036854775808)::int8 / (-1)::int8;
+SELECT (-9223372036854775808)::int8 % (-1)::int8;
+SELECT (-9223372036854775808)::int8 * (-1)::int4;
+SELECT (-9223372036854775808)::int8 / (-1)::int4;
+SELECT (-9223372036854775808)::int8 % (-1)::int4;
+SELECT (-9223372036854775808)::int8 * (-1)::int2;
+SELECT (-9223372036854775808)::int8 / (-1)::int2;
+SELECT (-9223372036854775808)::int8 % (-1)::int2;
+-- check rounding when casting from float
+SELECT x, x::int8 AS int8_value
+FROM (VALUES (-2.5::float8),
+ (-1.5::float8),
+ (-0.5::float8),
+ (0.0::float8),
+ (0.5::float8),
+ (1.5::float8),
+ (2.5::float8)) t(x);
+-- check rounding when casting from numeric
+SELECT x, x::int8 AS int8_value
+FROM (VALUES (-2.5::numeric),
+ (-1.5::numeric),
+ (-0.5::numeric),
+ (0.0::numeric),
+ (0.5::numeric),
+ (1.5::numeric),
+ (2.5::numeric)) t(x);
+-- test gcd()
+SELECT a, b, gcd(a, b), gcd(a, -b), gcd(b, a), gcd(-b, a)
+FROM (VALUES (0::int8, 0::int8),
+ (0::int8, 29893644334::int8),
+ (288484263558::int8, 29893644334::int8),
+ (-288484263558::int8, 29893644334::int8),
+ ((-9223372036854775808)::int8, 1::int8),
+ ((-9223372036854775808)::int8, 9223372036854775807::int8),
+ ((-9223372036854775808)::int8, 4611686018427387904::int8)) AS v(a, b);
+SELECT gcd((-9223372036854775808)::int8, 0::int8); -- overflow
+SELECT gcd((-9223372036854775808)::int8, (-9223372036854775808)::int8); -- overflow
+-- test lcm()
+SELECT a, b, lcm(a, b), lcm(a, -b), lcm(b, a), lcm(-b, a)
+FROM (VALUES (0::int8, 0::int8),
+ (0::int8, 29893644334::int8),
+ (29893644334::int8, 29893644334::int8),
+ (288484263558::int8, 29893644334::int8),
+ (-288484263558::int8, 29893644334::int8),
+ ((-9223372036854775808)::int8, 0::int8)) AS v(a, b);
+SELECT lcm((-9223372036854775808)::int8, 1::int8); -- overflow
+SELECT lcm(9223372036854775807::int8, 9223372036854775806::int8); -- overflow
diff --git a/ydb/library/yql/tests/postgresql/cases/numeric.err b/ydb/library/yql/tests/postgresql/cases/numeric.err
index 421fe55e56e1..314ec901ad0d 100644
--- a/ydb/library/yql/tests/postgresql/cases/numeric.err
+++ b/ydb/library/yql/tests/postgresql/cases/numeric.err
@@ -3612,6 +3612,537 @@ select * from generate_series(-100::numeric, 100::numeric, 0::numeric);
select * from generate_series(-100::numeric, 100::numeric, 'nan'::numeric);
-pgrun: /-S/ydbwork/ydb/contrib/libs/llvm12/lib/IR/LegacyPassManager.cpp:588: void llvm::PMTopLevelManager::setLastUser(ArrayRef, Pass *): Assertion `AnalysisPass && "Expected analysis pass to exist."' failed.
-pthread_kill at ./nptl/./nptl/pthread_kill.c:43:17
-?? at ??:0:0
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select * from generate_series(-100::numeric, 100::numeric, 'nan'::numeric);
+ ^
+ -stdin-::1:1: Fatal: ERROR: step size cannot be NaN
+
+ select * from generate_series(-100::numeric, 100::numeric, 'nan'::numeric);
+ ^
+
+select * from generate_series('nan'::numeric, 100::numeric, 10::numeric);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select * from generate_series('nan'::numeric, 100::numeric, 10::numeric);
+ ^
+ -stdin-::1:1: Fatal: ERROR: start value cannot be NaN
+
+ select * from generate_series('nan'::numeric, 100::numeric, 10::numeric);
+ ^
+
+select * from generate_series(0::numeric, 'nan'::numeric, 10::numeric);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select * from generate_series(0::numeric, 'nan'::numeric, 10::numeric);
+ ^
+ -stdin-::1:1: Fatal: ERROR: stop value cannot be NaN
+
+ select * from generate_series(0::numeric, 'nan'::numeric, 10::numeric);
+ ^
+
+select * from generate_series('inf'::numeric, 'inf'::numeric, 10::numeric);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select * from generate_series('inf'::numeric, 'inf'::numeric, 10::numeric);
+ ^
+ -stdin-::1:1: Fatal: ERROR: start value cannot be infinity
+
+ select * from generate_series('inf'::numeric, 'inf'::numeric, 10::numeric);
+ ^
+
+select * from generate_series(0::numeric, 'inf'::numeric, 10::numeric);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select * from generate_series(0::numeric, 'inf'::numeric, 10::numeric);
+ ^
+ -stdin-::1:1: Fatal: ERROR: stop value cannot be infinity
+
+ select * from generate_series(0::numeric, 'inf'::numeric, 10::numeric);
+ ^
+
+select * from generate_series(0::numeric, '42'::numeric, '-inf'::numeric);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select * from generate_series(0::numeric, '42'::numeric, '-inf'::numeric);
+ ^
+ -stdin-::1:1: Fatal: ERROR: step size cannot be infinity
+
+ select * from generate_series(0::numeric, '42'::numeric, '-inf'::numeric);
+ ^
+
+-- Checks maximum, output is truncated
+select (i / (10::numeric ^ 131071))::numeric(1,0)
+ from generate_series(6 * (10::numeric ^ 131071),
+ 9 * (10::numeric ^ 131071),
+ 10::numeric ^ 131071) as a(i);
+
+
+-- Check usage with variables
+select * from generate_series(1::numeric, 3::numeric) i, generate_series(i,3) j;
+
+-stdin-:: Error: Parse Sql
+
+ -stdin-::2:74: Error: Columns are not allowed in: RANGE FUNCTION
+ select * from generate_series(1::numeric, 3::numeric) i, generate_series(i,3) j;
+ ^
+
+select * from generate_series(1::numeric, 3::numeric) i, generate_series(1,i) j;
+
+-stdin-:: Error: Parse Sql
+
+ -stdin-::1:76: Error: Columns are not allowed in: RANGE FUNCTION
+ select * from generate_series(1::numeric, 3::numeric) i, generate_series(1,i) j;
+ ^
+
+select * from generate_series(1::numeric, 3::numeric) i, generate_series(1,5,i) j;
+
+-stdin-:: Error: Parse Sql
+
+ -stdin-::1:78: Error: Columns are not allowed in: RANGE FUNCTION
+ select * from generate_series(1::numeric, 3::numeric) i, generate_series(1,5,i) j;
+ ^
+
+--
+-- Tests for LN()
+--
+-- Invalid inputs
+select ln(-12.34);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ --
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot take logarithm of a negative number
+
+ --
+ ^
+
+select ln(0.0);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select ln(0.0);
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot take logarithm of zero
+
+ select ln(0.0);
+ ^
+
+-- Some random tests
+select ln(1.2345678e-28);
+
+
+select ln(0.0456789);
+
+
+select ln(0.349873948359354029493948309745709580730482050975);
+
+
+select ln(0.99949452);
+
+
+select ln(1.00049687395);
+
+
+select ln(1234.567890123456789);
+
+
+select ln(5.80397490724e5);
+
+
+select ln(9.342536355e34);
+
+
+--
+-- Tests for LOG() (base 10)
+--
+-- invalid inputs
+select log(-12.34);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ --
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot take logarithm of a negative number
+
+ --
+ ^
+
+select log(0.0);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select log(0.0);
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot take logarithm of zero
+
+ select log(0.0);
+ ^
+
+-- some random tests
+select log(1.234567e-89);
+
+
+select log(3.4634998359873254962349856073435545);
+
+
+select log(9.999999999999999999);
+
+
+select log(10.00000000000000000);
+
+
+select log(10.00000000000000001);
+
+
+select log(590489.45235237);
+
+
+--
+-- Tests for LOG() (arbitrary base)
+--
+-- invalid inputs
+select log(-12.34, 56.78);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ --
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot take logarithm of a negative number
+
+ --
+ ^
+
+select log(-12.34, -56.78);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select log(-12.34, -56.78);
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot take logarithm of a negative number
+
+ select log(-12.34, -56.78);
+ ^
+
+select log(12.34, -56.78);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select log(12.34, -56.78);
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot take logarithm of a negative number
+
+ select log(12.34, -56.78);
+ ^
+
+select log(0.0, 12.34);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select log(0.0, 12.34);
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot take logarithm of zero
+
+ select log(0.0, 12.34);
+ ^
+
+select log(12.34, 0.0);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select log(12.34, 0.0);
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot take logarithm of zero
+
+ select log(12.34, 0.0);
+ ^
+
+select log(1.0, 12.34);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ select log(1.0, 12.34);
+ ^
+ -stdin-::1:1: Fatal: ERROR: division by zero
+
+ select log(1.0, 12.34);
+ ^
+
+-- some random tests
+select log(1.23e-89, 6.4689e45);
+
+
+select log(0.99923, 4.58934e34);
+
+
+select log(1.000016, 8.452010e18);
+
+
+select log(3.1954752e47, 9.4792021e-73);
+
+
+--
+-- Tests for scale()
+--
+select scale(numeric 'NaN');
+
+
+select scale(numeric 'inf');
+
+
+select scale(NULL::numeric);
+
+
+select scale(1.12);
+
+
+select scale(0);
+
+
+select scale(0.00);
+
+
+select scale(1.12345);
+
+
+select scale(110123.12475871856128);
+
+
+select scale(-1123.12471856128);
+
+
+select scale(-13.000000000000000);
+
+
+--
+-- Tests for min_scale()
+--
+select min_scale(numeric 'NaN') is NULL; -- should be true
+
+
+select min_scale(numeric 'inf') is NULL; -- should be true
+
+
+select min_scale(0); -- no digits
+
+
+select min_scale(0.00); -- no digits again
+
+
+select min_scale(1.0); -- no scale
+
+
+select min_scale(1.1); -- scale 1
+
+
+select min_scale(1.12); -- scale 2
+
+
+select min_scale(1.123); -- scale 3
+
+
+select min_scale(1.1234); -- scale 4, filled digit
+
+
+select min_scale(1.12345); -- scale 5, 2 NDIGITS
+
+
+select min_scale(1.1000); -- 1 pos in NDIGITS
+
+
+select min_scale(1e100); -- very big number
+
+
+--
+-- Tests for trim_scale()
+--
+select trim_scale(numeric 'NaN');
+
+
+select trim_scale(numeric 'inf');
+
+
+select trim_scale(1.120);
+
+
+select trim_scale(0);
+
+
+select trim_scale(0.00);
+
+
+select trim_scale(1.1234500);
+
+
+select trim_scale(110123.12475871856128000);
+
+
+select trim_scale(-1123.124718561280000000);
+
+
+select trim_scale(-13.00000000000000000000);
+
+
+select trim_scale(1e100);
+
+
+--
+-- Tests for SUM()
+--
+-- cases that need carry propagation
+SELECT SUM(9999::numeric) FROM generate_series(1, 100000);
+
+
+SELECT SUM((-9999)::numeric) FROM generate_series(1, 100000);
+
+
+--
+-- Tests for GCD()
+--
+SELECT a, b, gcd(a, b), gcd(a, -b), gcd(-b, a), gcd(-b, -a)
+FROM (VALUES (0::numeric, 0::numeric),
+ (0::numeric, numeric 'NaN'),
+ (0::numeric, 46375::numeric),
+ (433125::numeric, 46375::numeric),
+ (43312.5::numeric, 4637.5::numeric),
+ (4331.250::numeric, 463.75000::numeric),
+ ('inf', '0'),
+ ('inf', '42'),
+ ('inf', 'inf')
+ ) AS v(a, b);
+
+
+--
+-- Tests for LCM()
+--
+SELECT a,b, lcm(a, b), lcm(a, -b), lcm(-b, a), lcm(-b, -a)
+FROM (VALUES (0::numeric, 0::numeric),
+ (0::numeric, numeric 'NaN'),
+ (0::numeric, 13272::numeric),
+ (13272::numeric, 13272::numeric),
+ (423282::numeric, 13272::numeric),
+ (42328.2::numeric, 1327.2::numeric),
+ (4232.820::numeric, 132.72000::numeric),
+ ('inf', '0'),
+ ('inf', '42'),
+ ('inf', 'inf')
+ ) AS v(a, b);
+
+
+SELECT lcm(9999 * (10::numeric)^131068 + (10::numeric^131068 - 1), 2); -- overflow
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT lcm(9999 * (10::numeric)^131068 + (10::numeric^131068 - 1), 2); -- overflow
+ ^
+ -stdin-::1:1: Fatal: ERROR: value overflows numeric format
+
+ SELECT lcm(9999 * (10::numeric)^131068 + (10::numeric^131068 - 1), 2); -- overflow
+ ^
+
+--
+-- Tests for factorial
+--
+SELECT factorial(4);
+
+
+SELECT factorial(15);
+
+
+SELECT factorial(100000);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT factorial(100000);
+ ^
+ -stdin-::1:1: Fatal: ERROR: value overflows numeric format
+
+ SELECT factorial(100000);
+ ^
+
+SELECT factorial(0);
+
+
+SELECT factorial(-4);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT factorial(-4);
+ ^
+ -stdin-::1:1: Fatal: ERROR: factorial of a negative number is undefined
+
+ SELECT factorial(-4);
+ ^
+
+--
+-- Tests for pg_lsn()
+--
+SELECT pg_lsn(23783416::numeric);
+
+
+SELECT pg_lsn(0::numeric);
+
+
+SELECT pg_lsn(18446744073709551615::numeric);
+
+
+SELECT pg_lsn(-1::numeric);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT pg_lsn(-1::numeric);
+ ^
+ -stdin-::1:1: Fatal: ERROR: pg_lsn out of range
+
+ SELECT pg_lsn(-1::numeric);
+ ^
+
+SELECT pg_lsn(18446744073709551616::numeric);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT pg_lsn(18446744073709551616::numeric);
+ ^
+ -stdin-::1:1: Fatal: ERROR: pg_lsn out of range
+
+ SELECT pg_lsn(18446744073709551616::numeric);
+ ^
+
+SELECT pg_lsn('NaN'::numeric);
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT pg_lsn('NaN'::numeric);
+ ^
+ -stdin-::1:1: Fatal: ERROR: cannot convert NaN to pg_lsn
+
+ SELECT pg_lsn('NaN'::numeric);
+ ^
diff --git a/ydb/library/yql/tests/postgresql/cases/numeric.out b/ydb/library/yql/tests/postgresql/cases/numeric.out
index 747a4a35931d..033ef7411171 100644
--- a/ydb/library/yql/tests/postgresql/cases/numeric.out
+++ b/ydb/library/yql/tests/postgresql/cases/numeric.out
@@ -1687,3 +1687,392 @@ select * from generate_series(4.0::numeric, -1.5::numeric, -2.2::numeric);
-0.4
(3 rows)
+-- Trigger errors
+select * from generate_series(-100::numeric, 100::numeric, 0::numeric);
+ERROR: step size cannot equal zero
+select * from generate_series(-100::numeric, 100::numeric, 'nan'::numeric);
+ERROR: step size cannot be NaN
+select * from generate_series('nan'::numeric, 100::numeric, 10::numeric);
+ERROR: start value cannot be NaN
+select * from generate_series(0::numeric, 'nan'::numeric, 10::numeric);
+ERROR: stop value cannot be NaN
+select * from generate_series('inf'::numeric, 'inf'::numeric, 10::numeric);
+ERROR: start value cannot be infinity
+select * from generate_series(0::numeric, 'inf'::numeric, 10::numeric);
+ERROR: stop value cannot be infinity
+select * from generate_series(0::numeric, '42'::numeric, '-inf'::numeric);
+ERROR: step size cannot be infinity
+-- Checks maximum, output is truncated
+select (i / (10::numeric ^ 131071))::numeric(1,0)
+ from generate_series(6 * (10::numeric ^ 131071),
+ 9 * (10::numeric ^ 131071),
+ 10::numeric ^ 131071) as a(i);
+ numeric
+---------
+ 6
+ 7
+ 8
+ 9
+(4 rows)
+
+--
+-- Tests for LN()
+--
+-- Invalid inputs
+select ln(-12.34);
+ERROR: cannot take logarithm of a negative number
+select ln(0.0);
+ERROR: cannot take logarithm of zero
+-- Some random tests
+select ln(1.2345678e-28);
+ ln
+-----------------------------------------
+ -64.26166165451762991204894255882820859
+(1 row)
+
+select ln(0.0456789);
+ ln
+---------------------
+ -3.0861187944847439
+(1 row)
+
+select ln(0.349873948359354029493948309745709580730482050975);
+ ln
+-----------------------------------------------------
+ -1.050182336912082775693991697979750253056317885460
+(1 row)
+
+select ln(0.99949452);
+ ln
+-------------------------
+ -0.00050560779808326467
+(1 row)
+
+select ln(1.00049687395);
+ ln
+------------------------
+ 0.00049675054901370394
+(1 row)
+
+select ln(1234.567890123456789);
+ ln
+--------------------
+ 7.1184763012977896
+(1 row)
+
+select ln(5.80397490724e5);
+ ln
+--------------------
+ 13.271468476626518
+(1 row)
+
+select ln(9.342536355e34);
+ ln
+--------------------
+ 80.522470935524187
+(1 row)
+
+--
+-- Tests for LOG() (base 10)
+--
+-- invalid inputs
+select log(-12.34);
+ERROR: cannot take logarithm of a negative number
+CONTEXT: SQL function "log" statement 1
+select log(0.0);
+ERROR: cannot take logarithm of zero
+CONTEXT: SQL function "log" statement 1
+--
+-- Tests for LOG() (arbitrary base)
+--
+-- invalid inputs
+select log(-12.34, 56.78);
+ERROR: cannot take logarithm of a negative number
+select log(-12.34, -56.78);
+ERROR: cannot take logarithm of a negative number
+select log(12.34, -56.78);
+ERROR: cannot take logarithm of a negative number
+select log(0.0, 12.34);
+ERROR: cannot take logarithm of zero
+select log(12.34, 0.0);
+ERROR: cannot take logarithm of zero
+select log(1.0, 12.34);
+ERROR: division by zero
+-- some random tests
+select log(1.23e-89, 6.4689e45);
+ log
+------------------------------------------------------------------------------------------------
+ -0.5152489207781856983977054971756484879653568168479201885425588841094788842469115325262329756
+(1 row)
+
+select log(0.99923, 4.58934e34);
+ log
+---------------------
+ -103611.55579544132
+(1 row)
+
+select log(1.000016, 8.452010e18);
+ log
+--------------------
+ 2723830.2877097365
+(1 row)
+
+select log(3.1954752e47, 9.4792021e-73);
+ log
+-------------------------------------------------------------------------------------
+ -1.51613372350688302142917386143459361608600157692779164475351842333265418126982165
+(1 row)
+
+--
+-- Tests for scale()
+--
+select scale(numeric 'NaN');
+ scale
+-------
+
+(1 row)
+
+select scale(numeric 'inf');
+ scale
+-------
+
+(1 row)
+
+select scale(NULL::numeric);
+ scale
+-------
+
+(1 row)
+
+select scale(1.12);
+ scale
+-------
+ 2
+(1 row)
+
+select scale(0);
+ scale
+-------
+ 0
+(1 row)
+
+select scale(0.00);
+ scale
+-------
+ 2
+(1 row)
+
+select scale(1.12345);
+ scale
+-------
+ 5
+(1 row)
+
+select scale(110123.12475871856128);
+ scale
+-------
+ 14
+(1 row)
+
+select scale(-1123.12471856128);
+ scale
+-------
+ 11
+(1 row)
+
+select scale(-13.000000000000000);
+ scale
+-------
+ 15
+(1 row)
+
+--
+-- Tests for min_scale()
+--
+select min_scale(numeric 'NaN') is NULL; -- should be true
+ ?column?
+----------
+ t
+(1 row)
+
+select min_scale(numeric 'inf') is NULL; -- should be true
+ ?column?
+----------
+ t
+(1 row)
+
+select min_scale(0); -- no digits
+ min_scale
+-----------
+ 0
+(1 row)
+
+select min_scale(0.00); -- no digits again
+ min_scale
+-----------
+ 0
+(1 row)
+
+select min_scale(1.0); -- no scale
+ min_scale
+-----------
+ 0
+(1 row)
+
+select min_scale(1.1); -- scale 1
+ min_scale
+-----------
+ 1
+(1 row)
+
+select min_scale(1.12); -- scale 2
+ min_scale
+-----------
+ 2
+(1 row)
+
+select min_scale(1.123); -- scale 3
+ min_scale
+-----------
+ 3
+(1 row)
+
+select min_scale(1.1234); -- scale 4, filled digit
+ min_scale
+-----------
+ 4
+(1 row)
+
+select min_scale(1.12345); -- scale 5, 2 NDIGITS
+ min_scale
+-----------
+ 5
+(1 row)
+
+select min_scale(1.1000); -- 1 pos in NDIGITS
+ min_scale
+-----------
+ 1
+(1 row)
+
+select min_scale(1e100); -- very big number
+ min_scale
+-----------
+ 0
+(1 row)
+
+--
+-- Tests for trim_scale()
+--
+select trim_scale(numeric 'NaN');
+ trim_scale
+------------
+ NaN
+(1 row)
+
+select trim_scale(numeric 'inf');
+ trim_scale
+------------
+ Infinity
+(1 row)
+
+select trim_scale(1.120);
+ trim_scale
+------------
+ 1.12
+(1 row)
+
+select trim_scale(1.1234500);
+ trim_scale
+------------
+ 1.12345
+(1 row)
+
+select trim_scale(110123.12475871856128000);
+ trim_scale
+-----------------------
+ 110123.12475871856128
+(1 row)
+
+select trim_scale(-1123.124718561280000000);
+ trim_scale
+-------------------
+ -1123.12471856128
+(1 row)
+
+select trim_scale(-13.00000000000000000000);
+ trim_scale
+------------
+ -13
+(1 row)
+
+--
+-- Tests for SUM()
+--
+-- cases that need carry propagation
+SELECT SUM(9999::numeric) FROM generate_series(1, 100000);
+ sum
+-----------
+ 999900000
+(1 row)
+
+SELECT SUM((-9999)::numeric) FROM generate_series(1, 100000);
+ sum
+------------
+ -999900000
+(1 row)
+
+SELECT lcm(9999 * (10::numeric)^131068 + (10::numeric^131068 - 1), 2); -- overflow
+ERROR: value overflows numeric format
+--
+-- Tests for factorial
+--
+SELECT factorial(4);
+ factorial
+-----------
+ 24
+(1 row)
+
+SELECT factorial(15);
+ factorial
+---------------
+ 1307674368000
+(1 row)
+
+SELECT factorial(100000);
+ERROR: value overflows numeric format
+SELECT factorial(0);
+ factorial
+-----------
+ 1
+(1 row)
+
+SELECT factorial(-4);
+ERROR: factorial of a negative number is undefined
+--
+-- Tests for pg_lsn()
+--
+SELECT pg_lsn(23783416::numeric);
+ pg_lsn
+-----------
+ 0/16AE7F8
+(1 row)
+
+SELECT pg_lsn(0::numeric);
+ pg_lsn
+--------
+ 0/0
+(1 row)
+
+SELECT pg_lsn(18446744073709551615::numeric);
+ pg_lsn
+-------------------
+ FFFFFFFF/FFFFFFFF
+(1 row)
+
+SELECT pg_lsn(-1::numeric);
+ERROR: pg_lsn out of range
+SELECT pg_lsn(18446744073709551616::numeric);
+ERROR: pg_lsn out of range
+SELECT pg_lsn('NaN'::numeric);
+ERROR: cannot convert NaN to pg_lsn
diff --git a/ydb/library/yql/tests/postgresql/cases/numeric.sql b/ydb/library/yql/tests/postgresql/cases/numeric.sql
index 1c74b6e46fd9..b960ee2cea36 100644
--- a/ydb/library/yql/tests/postgresql/cases/numeric.sql
+++ b/ydb/library/yql/tests/postgresql/cases/numeric.sql
@@ -833,3 +833,114 @@ select exp(-123.456);
select * from generate_series(0.0::numeric, 4.0::numeric);
select * from generate_series(0.1::numeric, 4.0::numeric, 1.3::numeric);
select * from generate_series(4.0::numeric, -1.5::numeric, -2.2::numeric);
+-- Trigger errors
+select * from generate_series(-100::numeric, 100::numeric, 0::numeric);
+select * from generate_series(-100::numeric, 100::numeric, 'nan'::numeric);
+select * from generate_series('nan'::numeric, 100::numeric, 10::numeric);
+select * from generate_series(0::numeric, 'nan'::numeric, 10::numeric);
+select * from generate_series('inf'::numeric, 'inf'::numeric, 10::numeric);
+select * from generate_series(0::numeric, 'inf'::numeric, 10::numeric);
+select * from generate_series(0::numeric, '42'::numeric, '-inf'::numeric);
+-- Checks maximum, output is truncated
+select (i / (10::numeric ^ 131071))::numeric(1,0)
+ from generate_series(6 * (10::numeric ^ 131071),
+ 9 * (10::numeric ^ 131071),
+ 10::numeric ^ 131071) as a(i);
+--
+-- Tests for LN()
+--
+-- Invalid inputs
+select ln(-12.34);
+select ln(0.0);
+-- Some random tests
+select ln(1.2345678e-28);
+select ln(0.0456789);
+select ln(0.349873948359354029493948309745709580730482050975);
+select ln(0.99949452);
+select ln(1.00049687395);
+select ln(1234.567890123456789);
+select ln(5.80397490724e5);
+select ln(9.342536355e34);
+--
+-- Tests for LOG() (base 10)
+--
+-- invalid inputs
+select log(-12.34);
+select log(0.0);
+--
+-- Tests for LOG() (arbitrary base)
+--
+-- invalid inputs
+select log(-12.34, 56.78);
+select log(-12.34, -56.78);
+select log(12.34, -56.78);
+select log(0.0, 12.34);
+select log(12.34, 0.0);
+select log(1.0, 12.34);
+-- some random tests
+select log(1.23e-89, 6.4689e45);
+select log(0.99923, 4.58934e34);
+select log(1.000016, 8.452010e18);
+select log(3.1954752e47, 9.4792021e-73);
+--
+-- Tests for scale()
+--
+select scale(numeric 'NaN');
+select scale(numeric 'inf');
+select scale(NULL::numeric);
+select scale(1.12);
+select scale(0);
+select scale(0.00);
+select scale(1.12345);
+select scale(110123.12475871856128);
+select scale(-1123.12471856128);
+select scale(-13.000000000000000);
+--
+-- Tests for min_scale()
+--
+select min_scale(numeric 'NaN') is NULL; -- should be true
+select min_scale(numeric 'inf') is NULL; -- should be true
+select min_scale(0); -- no digits
+select min_scale(0.00); -- no digits again
+select min_scale(1.0); -- no scale
+select min_scale(1.1); -- scale 1
+select min_scale(1.12); -- scale 2
+select min_scale(1.123); -- scale 3
+select min_scale(1.1234); -- scale 4, filled digit
+select min_scale(1.12345); -- scale 5, 2 NDIGITS
+select min_scale(1.1000); -- 1 pos in NDIGITS
+select min_scale(1e100); -- very big number
+--
+-- Tests for trim_scale()
+--
+select trim_scale(numeric 'NaN');
+select trim_scale(numeric 'inf');
+select trim_scale(1.120);
+select trim_scale(1.1234500);
+select trim_scale(110123.12475871856128000);
+select trim_scale(-1123.124718561280000000);
+select trim_scale(-13.00000000000000000000);
+--
+-- Tests for SUM()
+--
+-- cases that need carry propagation
+SELECT SUM(9999::numeric) FROM generate_series(1, 100000);
+SELECT SUM((-9999)::numeric) FROM generate_series(1, 100000);
+SELECT lcm(9999 * (10::numeric)^131068 + (10::numeric^131068 - 1), 2); -- overflow
+--
+-- Tests for factorial
+--
+SELECT factorial(4);
+SELECT factorial(15);
+SELECT factorial(100000);
+SELECT factorial(0);
+SELECT factorial(-4);
+--
+-- Tests for pg_lsn()
+--
+SELECT pg_lsn(23783416::numeric);
+SELECT pg_lsn(0::numeric);
+SELECT pg_lsn(18446744073709551615::numeric);
+SELECT pg_lsn(-1::numeric);
+SELECT pg_lsn(18446744073709551616::numeric);
+SELECT pg_lsn('NaN'::numeric);
diff --git a/ydb/library/yql/tests/postgresql/cases/strings.err b/ydb/library/yql/tests/postgresql/cases/strings.err
index ca7617bb64a1..1fd47d334145 100644
--- a/ydb/library/yql/tests/postgresql/cases/strings.err
+++ b/ydb/library/yql/tests/postgresql/cases/strings.err
@@ -907,6 +907,151 @@ SELECT foo, length(foo) FROM regexp_split_to_table('thE QUick bROWn FOx jUMPs ov
SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'iz');
-pgrun: /home/runner/actions_runner/_work/ydb/ydb/contrib/libs/llvm12/lib/IR/LegacyPassManager.cpp:588: void llvm::PMTopLevelManager::setLastUser(ArrayRef, Pass *): Assertion `AnalysisPass && "Expected analysis pass to exist."' failed.
-pthread_kill at ./nptl/./nptl/pthread_kill.c:43:17
-?? at ??:0:0
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'iz');
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid regular expression option: "z"
+
+ SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'iz');
+ ^
+
+-- global option meaningless for regexp_split
+SELECT foo, length(foo) FROM regexp_split_to_table('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'g') AS foo;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ -- global option meaningless for regexp_split
+ ^
+ -stdin-::1:1: Fatal: ERROR: regexp_split_to_table() does not support the "global" option
+
+ -- global option meaningless for regexp_split
+ ^
+
+SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'g');
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'g');
+ ^
+ -stdin-::1:1: Fatal: ERROR: regexp_split_to_array() does not support the "global" option
+
+ SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'g');
+ ^
+
+-- change NULL-display back
+\pset null ''
+
+
+-- E021-11 position expression
+SELECT POSITION('4' IN '1234567890') = '4' AS "4";
+
+
+SELECT POSITION('5' IN '1234567890') = '5' AS "5";
+
+
+-- T312 character overlay function
+SELECT OVERLAY('abcdef' PLACING '45' FROM 4) AS "abc45f";
+
+
+SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5) AS "yabadaba";
+
+
+SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5 FOR 0) AS "yabadabadoo";
+
+
+SELECT OVERLAY('babosa' PLACING 'ubb' FROM 2 FOR 4) AS "bubba";
+
+
+--
+-- test LIKE
+-- Be sure to form every test as a LIKE/NOT LIKE pair.
+--
+-- simplest examples
+-- E061-04 like predicate
+SELECT 'hawkeye' LIKE 'h%' AS "true";
+
+
+SELECT 'hawkeye' NOT LIKE 'h%' AS "false";
+
+
+SELECT 'hawkeye' LIKE 'H%' AS "false";
+
+
+SELECT 'hawkeye' NOT LIKE 'H%' AS "true";
+
+
+SELECT 'hawkeye' LIKE 'indio%' AS "false";
+
+
+SELECT 'hawkeye' NOT LIKE 'indio%' AS "true";
+
+
+SELECT 'hawkeye' LIKE 'h%eye' AS "true";
+
+VERIFY failed (2024-01-26T22:29:45.165869+0300):
+ util/generic/ptr.h:110
+ operator->(): requirement ptr failed
+BackTrace(void**, unsigned long)+29 (0x1A8988FD)
+FormatBackTrace(IOutputStream*)+282 (0x1A899BCA)
+PrintBackTrace()+17 (0x1A899C81)
+NPrivate::InternalPanicImpl(int, char const*, char const*, int, int, int, TBasicStringBuf >, char const*, unsigned long)+1629 (0x1A9ECF8D)
+NPrivate::Panic(NPrivate::TStaticBuf const&, int, char const*, char const*, char const*, ...)+1064 (0x1A9C4A28)
+TPointerCommon >, NYql::IUdfResolver const>::operator->() const+764 (0x2326685C)
+NYql::NTypeAnnImpl::TExtContext::LoadUdfMetadata(TVector > const&)+1109 (0x246C4715)
+NYql::NTypeAnnImpl::UdfWrapper(TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)+14463 (0x2477735F)
+decltype(std::declval > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)>()(std::declval > const&>(), std::declval >&>(), std::declval())) std::__y1::__invoke[abi:v160000] > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&), TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&>(NYql::IGraphTransformer::TStatus (*&)(TIntrusivePtr::__call > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&), TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&>(NYql::IGraphTransformer::TStatus (*&)(TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&), TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)+235 (0x24917E4B)
+std::__y1::__function::__alloc_func > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&), std::__y1::allocator > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)>, NYql::IGraphTransformer::TStatus (TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)>::operator()[abi:v160000](TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)+243 (0x24917C63)
+std::__y1::__function::__func > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&), std::__y1::allocator > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)>, NYql::IGraphTransformer::TStatus (TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)>::operator()(TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)+239 (0x249153DF)
+std::__y1::__function::__value_func > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)>::operator()[abi:v160000](TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&) const+515 (0x248A14B3)
+std::__y1::function > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&)>::operator()(TIntrusivePtr > const&, TIntrusivePtr >&, NYql::NTypeAnnImpl::TExtContext&) const+235 (0x2489D08B)
+NYql::NTypeAnnImpl::TExtCallableTypeAnnotationTransformer::ProcessCore(TIntrusivePtr > const&, TIntrusivePtr >&, NYql::TExprContext&)+1158 (0x24893E36)
+NYql::TCallableTransformerBase::DoTransform(TIntrusivePtr >, TIntrusivePtr >&, NYql::TExprContext&)+2009 (0x24890B89)
+NYql::TGraphTransformerBase::Transform(TIntrusivePtr >, TIntrusivePtr >&, NYql::TExprContext&)+532 (0x1D92DCC4)
+??+0 (0x24C875E4)
+??+0 (0x24C8706B)
+??+0 (0x24C8515A)
+??+0 (0x24C8706B)
+??+0 (0x24C8706B)
+??+0 (0x24C8706B)
+??+0 (0x24C8706B)
+??+0 (0x24C86443)
+??+0 (0x24C8706B)
+??+0 (0x24C8515A)
+??+0 (0x24C8515A)
+??+0 (0x24C8515A)
+??+0 (0x24C8706B)
+??+0 (0x24C8515A)
+??+0 (0x24C8515A)
+??+0 (0x24C8515A)
+??+0 (0x24C8706B)
+??+0 (0x24C8706B)
+??+0 (0x24C8706B)
+??+0 (0x24C7809A)
+NYql::TGraphTransformerBase::Transform(TIntrusivePtr >, TIntrusivePtr >&, NYql::TExprContext&)+532 (0x1D92DCC4)
+??+0 (0x1D93CFDC)
+??+0 (0x1D93C7FD)
+??+0 (0x1D92F5BD)
+NYql::TGraphTransformerBase::Transform(TIntrusivePtr >, TIntrusivePtr >&, NYql::TExprContext&)+532 (0x1D92DCC4)
+NYql::AsyncTransformStepImpl(NYql::IGraphTransformer&, TIntrusivePtr >&, NYql::TExprContext&, bool, bool, TBasicStringBuf > const&)+3920 (0x1D92B450)
+NYql::AsyncTransform(NYql::IGraphTransformer&, TIntrusivePtr >&, NYql::TExprContext&, bool)+439 (0x1D92CB87)
+NYql::TProgram::AsyncTransformWithFallback(bool)+353 (0x211DCC21)
+??+0 (0x2126713F)
+??+0 (0x2126676E)
+??+0 (0x21266494)
+??+0 (0x2126232E)
+??+0 (0x21261F27)
+??+0 (0x211D8B8D)
+NYql::TProgram::RunAsync(TBasicString > const&, IOutputStream*, IOutputStream*, IOutputStream*, bool)+6891 (0x211D7E9B)
+??+0 (0x211CFC2F)
+NYql::TProgram::Run(TBasicString > const&, IOutputStream*, IOutputStream*, IOutputStream*, bool)+1206 (0x211D6106)
+Main(int, char**)+11684 (0x1A2E8D54)
+main+630 (0x1A2EDBC6)
+??+0 (0x7F1191229D90)
+__libc_start_main+128 (0x7F1191229E40)
+??+0 (0x19FDE029)
+./nptl/pthread_kill.c:43:0 in __pthread_kill_implementation ./nptl/pthread_kill.c:78:0 in __pthread_kill_internal ./nptl/pthread_kill.c:89:0 in __GI___pthread_kill ???:0:0 in ???
\ No newline at end of file
diff --git a/ydb/library/yql/tests/postgresql/cases/strings.out b/ydb/library/yql/tests/postgresql/cases/strings.out
index f5c88263fc9d..455886557403 100644
--- a/ydb/library/yql/tests/postgresql/cases/strings.out
+++ b/ydb/library/yql/tests/postgresql/cases/strings.out
@@ -556,3 +556,95 @@ SELECT regexp_split_to_array('1','');
{1}
(1 row)
+-- errors
+SELECT foo, length(foo) FROM regexp_split_to_table('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'zippy') AS foo;
+ERROR: invalid regular expression option: "z"
+SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'iz');
+ERROR: invalid regular expression option: "z"
+-- global option meaningless for regexp_split
+SELECT foo, length(foo) FROM regexp_split_to_table('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'g') AS foo;
+ERROR: regexp_split_to_table() does not support the "global" option
+SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'g');
+ERROR: regexp_split_to_array() does not support the "global" option
+-- change NULL-display back
+\pset null ''
+-- E021-11 position expression
+SELECT POSITION('4' IN '1234567890') = '4' AS "4";
+ 4
+---
+ t
+(1 row)
+
+SELECT POSITION('5' IN '1234567890') = '5' AS "5";
+ 5
+---
+ t
+(1 row)
+
+-- T312 character overlay function
+SELECT OVERLAY('abcdef' PLACING '45' FROM 4) AS "abc45f";
+ abc45f
+--------
+ abc45f
+(1 row)
+
+SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5) AS "yabadaba";
+ yabadaba
+----------
+ yabadaba
+(1 row)
+
+SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5 FOR 0) AS "yabadabadoo";
+ yabadabadoo
+-------------
+ yabadabadoo
+(1 row)
+
+SELECT OVERLAY('babosa' PLACING 'ubb' FROM 2 FOR 4) AS "bubba";
+ bubba
+-------
+ bubba
+(1 row)
+
+--
+-- test LIKE
+-- Be sure to form every test as a LIKE/NOT LIKE pair.
+--
+-- simplest examples
+-- E061-04 like predicate
+SELECT 'hawkeye' LIKE 'h%' AS "true";
+ true
+------
+ t
+(1 row)
+
+SELECT 'hawkeye' NOT LIKE 'h%' AS "false";
+ false
+-------
+ f
+(1 row)
+
+SELECT 'hawkeye' LIKE 'H%' AS "false";
+ false
+-------
+ f
+(1 row)
+
+SELECT 'hawkeye' NOT LIKE 'H%' AS "true";
+ true
+------
+ t
+(1 row)
+
+SELECT 'hawkeye' LIKE 'indio%' AS "false";
+ false
+-------
+ f
+(1 row)
+
+SELECT 'hawkeye' NOT LIKE 'indio%' AS "true";
+ true
+------
+ t
+(1 row)
+
diff --git a/ydb/library/yql/tests/postgresql/cases/strings.sql b/ydb/library/yql/tests/postgresql/cases/strings.sql
index ce760be418c6..aee614e6fee8 100644
--- a/ydb/library/yql/tests/postgresql/cases/strings.sql
+++ b/ydb/library/yql/tests/postgresql/cases/strings.sql
@@ -117,3 +117,31 @@ SELECT regexp_split_to_array('123456','.');
SELECT regexp_split_to_array('123456','');
SELECT regexp_split_to_array('123456','(?:)');
SELECT regexp_split_to_array('1','');
+-- errors
+SELECT foo, length(foo) FROM regexp_split_to_table('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'zippy') AS foo;
+SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'iz');
+-- global option meaningless for regexp_split
+SELECT foo, length(foo) FROM regexp_split_to_table('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'g') AS foo;
+SELECT regexp_split_to_array('thE QUick bROWn FOx jUMPs ovEr The lazy dOG', 'e', 'g');
+-- change NULL-display back
+\pset null ''
+-- E021-11 position expression
+SELECT POSITION('4' IN '1234567890') = '4' AS "4";
+SELECT POSITION('5' IN '1234567890') = '5' AS "5";
+-- T312 character overlay function
+SELECT OVERLAY('abcdef' PLACING '45' FROM 4) AS "abc45f";
+SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5) AS "yabadaba";
+SELECT OVERLAY('yabadoo' PLACING 'daba' FROM 5 FOR 0) AS "yabadabadoo";
+SELECT OVERLAY('babosa' PLACING 'ubb' FROM 2 FOR 4) AS "bubba";
+--
+-- test LIKE
+-- Be sure to form every test as a LIKE/NOT LIKE pair.
+--
+-- simplest examples
+-- E061-04 like predicate
+SELECT 'hawkeye' LIKE 'h%' AS "true";
+SELECT 'hawkeye' NOT LIKE 'h%' AS "false";
+SELECT 'hawkeye' LIKE 'H%' AS "false";
+SELECT 'hawkeye' NOT LIKE 'H%' AS "true";
+SELECT 'hawkeye' LIKE 'indio%' AS "false";
+SELECT 'hawkeye' NOT LIKE 'indio%' AS "true";
diff --git a/ydb/library/yql/tests/postgresql/cases/timestamp.out b/ydb/library/yql/tests/postgresql/cases/timestamp.out
index b25c498663b7..ce0cdff10912 100644
--- a/ydb/library/yql/tests/postgresql/cases/timestamp.out
+++ b/ydb/library/yql/tests/postgresql/cases/timestamp.out
@@ -314,3 +314,8 @@ SELECT i,
-- should fail
select make_timestamp(0, 7, 15, 12, 30, 15);
ERROR: date field value out of range: 0-07-15
+-- errors
+select * from generate_series('2020-01-01 00:00'::timestamp,
+ '2020-01-02 03:00'::timestamp,
+ '0 hour'::interval);
+ERROR: step size cannot equal zero
diff --git a/ydb/library/yql/tests/postgresql/cases/timestamp.sql b/ydb/library/yql/tests/postgresql/cases/timestamp.sql
index 19eb50425497..99f15ee04e6a 100644
--- a/ydb/library/yql/tests/postgresql/cases/timestamp.sql
+++ b/ydb/library/yql/tests/postgresql/cases/timestamp.sql
@@ -190,3 +190,7 @@ SELECT i,
FROM generate_series(-13, 13) i;
-- should fail
select make_timestamp(0, 7, 15, 12, 30, 15);
+-- errors
+select * from generate_series('2020-01-01 00:00'::timestamp,
+ '2020-01-02 03:00'::timestamp,
+ '0 hour'::interval);
diff --git a/ydb/library/yql/tests/postgresql/cases/timestamptz.err b/ydb/library/yql/tests/postgresql/cases/timestamptz.err
index 263087a9d0d7..f2d63386e049 100644
--- a/ydb/library/yql/tests/postgresql/cases/timestamptz.err
+++ b/ydb/library/yql/tests/postgresql/cases/timestamptz.err
@@ -1142,6 +1142,1198 @@ SET TimeZone to 'UTC';
SELECT '2011-03-27 00:00:00 Europe/Moscow'::timestamptz;
-pgrun: /-S/ydbwork/ydb/contrib/libs/llvm12/lib/IR/LegacyPassManager.cpp:588: void llvm::PMTopLevelManager::setLastUser(ArrayRef, Pass *): Assertion `AnalysisPass && "Expected analysis pass to exist."' failed.
-pthread_kill at ./nptl/./nptl/pthread_kill.c:43:17
-?? at ??:0:0
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 00:00:00 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2011-03-27 00:00:00 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2011-03-27 01:00:00 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 01:00:00 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2011-03-27 01:00:00 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2011-03-27 01:59:59 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 01:59:59 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2011-03-27 01:59:59 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2011-03-27 02:00:00 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 02:00:00 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2011-03-27 02:00:00 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2011-03-27 02:00:01 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 02:00:01 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2011-03-27 02:00:01 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2011-03-27 02:59:59 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 02:59:59 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2011-03-27 02:59:59 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2011-03-27 03:00:00 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 03:00:00 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2011-03-27 03:00:00 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2011-03-27 03:00:01 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 03:00:01 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2011-03-27 03:00:01 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2011-03-27 04:00:00 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 04:00:00 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2011-03-27 04:00:00 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2011-03-27 00:00:00 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 00:00:00 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2011-03-27 00:00:00 MSK"
+
+ SELECT '2011-03-27 00:00:00 MSK'::timestamptz;
+ ^
+
+SELECT '2011-03-27 01:00:00 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 01:00:00 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2011-03-27 01:00:00 MSK"
+
+ SELECT '2011-03-27 01:00:00 MSK'::timestamptz;
+ ^
+
+SELECT '2011-03-27 01:59:59 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 01:59:59 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2011-03-27 01:59:59 MSK"
+
+ SELECT '2011-03-27 01:59:59 MSK'::timestamptz;
+ ^
+
+SELECT '2011-03-27 02:00:00 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 02:00:00 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2011-03-27 02:00:00 MSK"
+
+ SELECT '2011-03-27 02:00:00 MSK'::timestamptz;
+ ^
+
+SELECT '2011-03-27 02:00:01 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 02:00:01 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2011-03-27 02:00:01 MSK"
+
+ SELECT '2011-03-27 02:00:01 MSK'::timestamptz;
+ ^
+
+SELECT '2011-03-27 02:59:59 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 02:59:59 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2011-03-27 02:59:59 MSK"
+
+ SELECT '2011-03-27 02:59:59 MSK'::timestamptz;
+ ^
+
+SELECT '2011-03-27 03:00:00 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 03:00:00 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2011-03-27 03:00:00 MSK"
+
+ SELECT '2011-03-27 03:00:00 MSK'::timestamptz;
+ ^
+
+SELECT '2011-03-27 03:00:01 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 03:00:01 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2011-03-27 03:00:01 MSK"
+
+ SELECT '2011-03-27 03:00:01 MSK'::timestamptz;
+ ^
+
+SELECT '2011-03-27 04:00:00 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2011-03-27 04:00:00 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2011-03-27 04:00:00 MSK"
+
+ SELECT '2011-03-27 04:00:00 MSK'::timestamptz;
+ ^
+
+SELECT '2014-10-26 00:00:00 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2014-10-26 00:00:00 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2014-10-26 00:00:00 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2014-10-26 00:59:59 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2014-10-26 00:59:59 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2014-10-26 00:59:59 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2014-10-26 01:00:00 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2014-10-26 01:00:00 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2014-10-26 01:00:00 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2014-10-26 01:00:01 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2014-10-26 01:00:01 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2014-10-26 01:00:01 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2014-10-26 02:00:00 Europe/Moscow'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2014-10-26 02:00:00 Europe/Moscow'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: time zone "europe/moscow" not recognized
+
+ SELECT '2014-10-26 02:00:00 Europe/Moscow'::timestamptz;
+ ^
+
+SELECT '2014-10-26 00:00:00 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2014-10-26 00:00:00 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2014-10-26 00:00:00 MSK"
+
+ SELECT '2014-10-26 00:00:00 MSK'::timestamptz;
+ ^
+
+SELECT '2014-10-26 00:59:59 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-::1:1: Fatal: Execution of node: Result
+ SELECT '2014-10-26 00:59:59 MSK'::timestamptz;
+ ^
+ -stdin-::1:1: Fatal: ERROR: invalid input syntax for type timestamp with time zone: "2014-10-26 00:59:59 MSK"
+
+ SELECT '2014-10-26 00:59:59 MSK'::timestamptz;
+ ^
+
+SELECT '2014-10-26 01:00:00 MSK'::timestamptz;
+
+-stdin-:: Fatal: Execution
+
+ -stdin-: