-
Notifications
You must be signed in to change notification settings - Fork 777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support sqlite stdlib functions #1712
Support sqlite stdlib functions #1712
Conversation
20c6abe
to
579cf78
Compare
{ | ||
Name: "COUNT", | ||
Args: []*catalog.Argument{}, | ||
ReturnType: &ast.TypeName{Name: "bigint"}, | ||
ReturnType: &ast.TypeName{Name: "integer"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change quite a bit of generated code. Is it documented that SQLite will always return an int here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In SQLite world, bigint
and integer
is totally same. SQLite can understand bigint
but it's just a alias.
Each column in an SQLite 3 database is assigned one of the following type affinities:
- TEXT
- NUMERIC
- INTEGER
- REAL
- BLOB
And bigint
is translate it to integer
.
https://www.sqlite.org/datatype3.html
Type definition in sqlc
is same. Both are translated to int64
in go world, so this change doesn't any impact for generated code.
I confirmed generated code is not changed.
So to keep consistency, I want to use integer
for all integer value for SQLite, because it's a true type for integer value. What do you think?
* move existing builtins to postgresql folder * [sqlite] support built-in aggregate functions https://www.sqlite.org/lang_aggfunc.html * [sqlite] support built-in mathematical functions https://www.sqlite.org/lang_mathfunc.html * [sqlite] support built-in scalar functions https://www.sqlite.org/lang_corefunc.html
Add SQLite function catalogs listed in below pages.
Task
builtins
end to end test tobuiltins/postgresql
Remarks
Due to current SQLite parser limitation, we can't get correct type of arguments of function, so we can't overload function based on argument type like below.
So arguments and return types of these functions like
max
are defined asany
type due to this limitation.