PostgreSQL error code
PostgreSQL error 2202H
2202H is the SQLSTATE PostgreSQL reports for invalid tablesample argument, in class 22, Data Exception.
| SQLSTATE | 2202H |
|---|---|
| Condition name | invalid_tablesample_argument |
| Class | 22 — Data Exception |
Reproduce it, then fix it
TABLESAMPLE takes the percentage of the table to sample, from 0 to 100. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
SELECT name FROM products TABLESAMPLE BERNOULLI (150);
SELECT name FROM products TABLESAMPLE BERNOULLI (50);