sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

FORMAT function reported as "not existing" with more than two arguments

Open ryan-berger opened this issue 3 years ago • 0 comments

Version

Other

What happened?

Using FORMAT with more than 2 arguments results in sqlc reporting that no function matching can be found.

FORMAT is a bit of a special case when it comes to the schema definition as Postgres defines it as:

create function format(text, "any") returns text

Even though it is variadic, meaning we can have "any" number of arguments after the first.

If you look at the spec for FORMAT, you should be able to see the difference between the definitions: https://www.postgresql.org/docs/current/functions-string.html

Relevant log output

function format(unknown, unknown, unknown, unknown) does not exist

Database schema

No response

SQL queries

SELECT FORMAT('%s %s %s', 'a', 'b', 'c')

Configuration

No response

Playground URL

https://play.sqlc.dev/p/fb4491f4688233615419473f8bcd934eab5de8c549c862aa55f2acf2908dcab4

What operating system are you using?

Linux

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

ryan-berger avatar Aug 09 '22 17:08 ryan-berger