Dienstag, 27. Februar 2024

Syntax error at "%" … "invalid type name" error in variable declaration of PL/pgSQL

There I was hunting down the cause mentioned error message, being quite clueless. Thankfully, the PostgreSQL e-mail list was helpful, nudging me in the right direction. The message was a bit obfuscated by my use of unusual characters in the names of my objects and variables, in my case: ⠒

I was believing that for some strange reason, PL/pgSQL was unable to handle this character in the type clause, e.g.

variable⠒name  table⠒name.column⠒name%TYPE;

The point was, that I had messed up the order of installation of the things. The table, I was trying to copy the type from, had not been recreated by the installation script yet. I would expect that the parser would return with a missing table/view message, but "invalid type name" is not wrong, if not so straight forward as it could be. The developers of that part actually were aware of a problem there. Maybe the will get around to improve the error message.

Keine Kommentare:

Kommentar veröffentlichen