PostgreSQL error code
PostgreSQL error 42P02
42P02 is the SQLSTATE PostgreSQL reports for undefined parameter, in class 42, Syntax Error or Access Rule Violation.
| SQLSTATE | 42P02 |
|---|---|
| Condition name | undefined_parameter |
| Class | 42 — Syntax Error or Access Rule Violation |
Reproduce it, then fix it
$1 is a placeholder that a driver or PREPARE fills in. Pasted into a SQL console, there is nothing to fill it with. Put the value in, or run the query through your driver. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
SELECT id, name FROM products WHERE id = $1;
SELECT id, name FROM products WHERE id = 1;