Skip to content

function date_add(unknown, unknown, unknown) does not exist #1178

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

Closed
huyennbl opened this issue Sep 12, 2021 · 1 comment · Fixed by #1180
Closed

function date_add(unknown, unknown, unknown) does not exist #1178

huyennbl opened this issue Sep 12, 2021 · 1 comment · Fixed by #1180
Labels
📚 mysql bug Something isn't working
Milestone

Comments

@huyennbl
Copy link

huyennbl commented Sep 12, 2021

Version

1.8.0

What happened?

All versions from 1.8 to 1.10 has this bug
MySQL 8

Relevant log output

query.sql:12:2: function date_add(unknown, unknown, unknown) does not exist

Database schema

CREATE TABLE `tokens` (
  `id` bigint PRIMARY KEY AUTO_INCREMENT,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

SQL queries

SELECT
	DATE_ADD(created_at, INTERVAL 7 HOUR)  as hello
FROM
	tokens

Configuration

version: "1"
packages:
  - name: "db"
    path: "./db/sqlc"
    queries: "./db/query/"
    schema: "./db/migration/"
    engine: "mysql"
    emit_interface: false
    emit_prepared_queries: false
    emit_exact_table_names: false
    emit_empty_slices: true

Playground URL

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

What operating system are you using?

Windows

What database engines are you using?

MySQL

What type of code are you generating?

Go

@huyennbl huyennbl added bug Something isn't working triage New issues that hasn't been reviewed labels Sep 12, 2021
@huyennbl
Copy link
Author

Workaround for this error: similar to #1172 , use MAKETIME

SELECT
	ADDTIME(created_at, maketime(7,0,0))
FROM
	tokens

@kyleconroy kyleconroy added 📚 mysql and removed triage New issues that hasn't been reviewed labels Sep 12, 2021
@kyleconroy kyleconroy added this to the v1.11.0 milestone Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 mysql bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants