sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.58k stars 812 forks source link

No support for function overloading #3660

Open prog8 opened 1 month ago

prog8 commented 1 month ago

Version

1.27.0

What happened?

I have Postgresql schema where I define overloaded function to handle many column types.

CREATE FUNCTION foo(text)
CREATE FUNCTION foo(text[])

Unfortunately during schema parsing sqlc returns an errors saying that function foo already exists which is not true. The function is in fact defined by full signature, not just the name.

Relevant log output

relation "foo" already exists

Database schema

CREATE FUNCTION foo(text)
CREATE FUNCTION foo(text[])


### SQL queries

_No response_

### Configuration

_No response_

### Playground URL

_No response_

### What operating system are you using?

_No response_

### What database engines are you using?

_No response_

### What type of code are you generating?

_No response_
prog8 commented 1 month ago

I looked at details and it seems the problem is just text vs text[]. If I try with completely different type like text vs number the problem disappears. This makes me think that that in fact there is signature check but for some reason text is confused with text[] like they are the same type.