PostgreSQL error code
PostgreSQL error 42P18
42P18 is the SQLSTATE PostgreSQL reports for indeterminate datatype, in class 42, Syntax Error or Access Rule Violation.
| SQLSTATE | 42P18 |
|---|---|
| Condition name | indeterminate_datatype |
| Class | 42 — Syntax Error or Access Rule Violation |
Reproduce it, then fix it
An empty ARRAY[] has no elements to take a type from. Cast it to the array type you want. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
SELECT name, ARRAY[] AS tags FROM products;
SELECT name, ARRAY[]::text[] AS tags FROM products;