Skip to content
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

pg_catalog tables and views not queryable (specifically pg_timezone_names) #1747

Closed
skabbes opened this issue Jul 16, 2022 · 0 comments · Fixed by #1811
Closed

pg_catalog tables and views not queryable (specifically pg_timezone_names) #1747

skabbes opened this issue Jul 16, 2022 · 0 comments · Fixed by #1811
Labels
📚 postgresql bug Something isn't working 💻 darwin triage New issues that hasn't been reviewed 🔧 golang

Comments

@skabbes
Copy link
Contributor

skabbes commented Jul 16, 2022

Version

1.14.0

What happened?

As part of a project, we are exposing a configuration parameter to allow users to configure their timezone. This allows us to send notifications at the correct times, is useful for reporting etc. Since we are using postgres for all the timezone calculations, we want to populate the list of available options to the users directly from pg_timezone_names. However, sqlc does not recognized that.

I have narrowed down the problem to sqlc-pg-gen not automatically populating pre-existing tables from pg_tables and pg_views. And will try to follow up with an actual PR to address this, but wanted to write up the issue first.

Relevant log output

# package queries
queries/timezone.sql:1:1: relation "pg_timezone_names" does not exist
make: *** [gen] Error 1

Database schema

-- no schema necessary

SQL queries

-- name: GetTimezones :many
select * from pg_catalog.pg_timezone_names;

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/9c6742a1a8575147dc27d496361747f0811296c775c7b43d04b3ef0250d3df3f

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 postgresql bug Something isn't working 💻 darwin triage New issues that hasn't been reviewed 🔧 golang
Projects
None yet
2 participants