Skip to content

No result when specifying created_at and/or updated_at columns #2323

@dbhiiper

Description

@dbhiiper

Version

1.18.0

What happened?

I get no results when using created_at or updated_at columns in SELECT statement. If i leave out the two columns then i get the expected results.
I've run the query including created_at and updated_at using DBeaver and it works correctly.

Relevant log output

No response

Database schema

CREATE TABLE jobs (
    id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    template_id BIGINT NOT NULL,
    status INT NOT NULL DEFAULT 1,
    report json,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (template_id) REFERENCES job_templates(id)
);

SQL queries

-- name: ListJobs :many
SELECT
    j.id,
    j.status,
    j.created_at,
    j.updated_at,
    jt.external_ref,
    jt.url,
    jt.job_schema,
    p.common_name as provider_name
FROM
    jobs j
    INNER JOIN job_templates jt ON j.template_id = jt.id
    INNER JOIN providers p ON jt.provider_id = p.id
WHERE
    j.status = ?;

Configuration

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

Playground URL

https://play.sqlc.dev/p/383409dd75455f035516b8b5a44074ba4c8c06d46ba1149402d1817921364b09

What operating system are you using?

Linux

What database engines are you using?

MySQL

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