unknownType¶
Group typecheck · Recommended · Needs a database connection · Since 0.27.0
Diagnostic lint/unknownType · Postgres error 42704
Description¶
A type does not exist.
Types are looked up in the connected database and in the types created earlier in the same file, following the search path.
Postgres raises 42704 undefined_object for these statements.
Examples¶
Invalid¶
select null::missing_type;
code-block.sql:1:14 lint/unknownType ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Type missing_type does not exist.
> 1 │ select null::missing_type;
│ ^^^^^^^^^^^^
2 │
Valid¶
create type mood as enum ('happy', 'sad');
select null::mood;
How to configure¶
{
"linter": {
"rules": {
"unknownType": "error"
}
}
}
How to suppress¶
Suppress this diagnostic with a comment:
-- pgls-ignore unknownType