Skip to content
Advertisement

Postgres Type of Parameter does not match

I am having an odd problem with Postgres (10.5). I have a function, generate_unique_name which takes in three text values. It works fine; however, calling this function seems to be an issue. When I call the function using:

It works without issue. I can make the same call several times. Now, when I try the same call, but change the second parameter as below:

Then it seems to fail with the error:

ERROR: type of parameter 9 (text) does not match that when preparing the plan (character varying) CONTEXT: PL/pgSQL function generate_unique_name(text,text,text) line 12 at assignment SQL state: 42804

I have tried changing the query to:

But this also fails. If I then kill the connection to postgres DB, and create a new one, and instead start with the second query, it now works, but the first stops functioning.

It seems like postgres decides to stop treating the parameters as text part way through, for no apparent reason. Am I missing something?

EDIT: Code for generate_unique_name

Advertisement

Answer

My guess is there’s a value in the name column of the queue table that causes an issue with

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement