I have one view with "pg_statio_all_tables" table and I can't generate code for this view. I don't know how I can continue with this view and sqlc.
Thank you
Relevant log output
# sqlc generate
# package db
# ../project/codelists/000010_view_columns.up.sql:1:1: relation "pg_statio_all_tables" does not exist
Database schema
CREATE VIEW "codelists"."view_columns" AS SELECT c.table_schema,
c.table_name,
c.column_name AS id,
split_part(pgd.description, '@'::text, 1) AS name,
split_part(pgd.description, '@'::text, 2)::boolean AS required,
split_part(pgd.description, '@'::text, 3)::boolean AS hidden,
split_part(pgd.description, '@'::text, 4)::boolean AS editable,
split_part(pgd.description, '@'::text, 5) AS codelist
FROM pg_statio_all_tables st
JOIN pg_description pgd ON pgd.objoid = st.relid
RIGHT JOIN information_schema.columns c ON pgd.objsubid = c.ordinal_position::integer AND c.table_schema::name = st.schemaname AND c.table_name::name = st.relname
WHERE c.table_schema::name = 'codelists'::name;
SQL queries
-- name: GetColumns :many
SELECT id, name, required, hidden, editable, codelist FROM codelists.view_columns WHERE table_name = @table_name AND table_schema = @table_schema;
I also encountered the same problem. The table creation sql and view creation sql files are not in the same sql file. This error message will appear. How to deal with it?
Version
1.27.0
What happened?
Hello,
I have one view with "pg_statio_all_tables" table and I can't generate code for this view. I don't know how I can continue with this view and sqlc.
Thank you
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
No response
What operating system are you using?
Linux, macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go