Skip to content

Singular form of a table name is not correct #4021

@yellow-straw-hat

Description

@yellow-straw-hat

Version

1.29.0

What happened?

Hello,

Having the following DB schema:

CREATE TABLE drives (
    id SERIAL PRIMARY KEY NOT NULL
);

When running:
sqlc generate

We got:

type Drife struct {
	ID                    int32     `db:"id"`
}

Relevant log output

Drive should be the singular form of Drives.

Database schema

CREATE TABLE drives (
    id SERIAL PRIMARY KEY NOT NULL
);

SQL queries

-- This is a dummy query, used only to satisfy sqlc's requirement

-- name: GetDrive :one
SELECT * FROM drives
WHERE id = $1 LIMIT 1;

Configuration

version: "2"
sql:
  - engine: postgresql
    queries: query.sql
    schema: ../db/schema.sql
    gen:
      go:
        package: model
        out: ../model
        sql_package: pgx/v5
        sql_driver: github.com/jackc/pgx/v5
        emit_db_tags: true
        emit_exact_table_names: false
        emit_pointers_for_null_types: true
        output_models_file_name: models.go
        overrides:
          - db_type: "pg_catalog.timestamp"
            go_type:
              type: "*time.Time"
            nullable: true
          - db_type: "pg_catalog.timestamp"
            go_type: "time.Time"
            nullable: false

Playground URL

No response

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