Skip to content

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

Closed
@ryan-berger

Description

@ryan-berger

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions