Skip to content

Add support for queries against information_schema tables #1800

Closed
@yehudamakarov

Description

@yehudamakarov

Version

Other

What happened?

I'm trying to generate a function from a query like this:

-- name: GetMyTableColumns :many
SELECT column_name,
       data_type
FROM information_schema.columns
WHERE table_name = 'my_table';

but I get the following error while generating:

schema "information_schema" does not exist

Relevant log output

schema "information_schema" does not exist

Database schema

information_schema, 
but in the sqlc.yaml I am using `schema: "migrations"` because I'm using `"github.com/golang-migrate/migrate/v4"`

SQL queries

-- name: GetMyTableColumns :one
SELECT column_name,
       data_type
FROM information_schema.columns
WHERE table_name = 'my_table';

Configuration

see above

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions