ERROR: negative substring length not allowed

By | February 12, 2017

PostgreSQL negative substring length not allowed

Wrong select

select substring('abc', 1,-1);
ERROR: negative substring length not allowed

Correct select

select substring('abc', 1, 1);
Data Output: a

select substring('abc', 1, 2);
Data Output: ab

Leave a Reply