Skip to content

Type name resolution differs in database mode (vs. traditional / static analysis) #2912

Open
@dhermes

Description

@dhermes

Version

1.23.0

What happened?

PostgreSQL column types resolve to different names in "database" mode vs. "static analysis" mode (i.e. the "old way"). Two examples encountered in our production codebase (a long-time user of sqlc):

Database Static analysis
html5_email_address app.html5_email_address
numeric pg_catalog.numeric

In both cases the schema is absent in "database" mode.

Relevant log output

No response

Database schema

CREATE SCHEMA s;

CREATE DOMAIN s.html5_email_address AS TEXT;

CREATE TABLE s.person (
  id         UUID PRIMARY KEY,
  first_name TEXT NOT NULL,
  last_name  TEXT NOT NULL,
  email      s.html5_email_address NOT NULL,
  height     NUMERIC NOT NULL
);

SQL queries

-- name: GetPerson :one
SELECT
  p.id,
  p.email,
  p.height
FROM
  s.person AS p
WHERE
  id = @id;

Configuration

No response

Playground URL

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

What operating system are you using?

Linux, macOS

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