You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried make example on playground as minimal for problem that I have. We have 3 schemas that was creating with 20+ migrations. We started using sqlc and generated models work and everything work for schema news as it's default schema, but isn't. I tried debug AST and looks that news schema is set as default and works only without prefix in queries that cause problem that we use public default schema where is majority of tables and I need use whole path for table in queries but that throw error as in playground example. query.sql:1:1: relation "authors" does not exist.
Only working queries are
-- name: GetAuthor :one
SELECT * FROM public.authors
WHERE id = $1 LIMIT 1;
-- name: GetPublisher :one
SELECT * FROM public.publishers
WHERE id = $1 LIMIT 1;
instead correct ones
-- name: GetAuthor :one
SELECT * FROM news.authors
WHERE id = $1 LIMIT 1;
-- name: GetPublisher :one
SELECT * FROM public.publishers
WHERE id = $1 LIMIT 1;
CREATESCHEMAnews;
SET search_path TO news;
CREATETABLEauthors (
id BIGSERIALPRIMARY KEY,
name textNOT NULL,
bio text
);
SET search_path TO public;
CREATETABLEpublishers (
id BIGSERIALPRIMARY KEY,
name textNOT NULL,
bio text
);
SQL queries
-- name: GetAuthor :oneSELECT*FROMnews.authorsWHERE id = $1LIMIT1;
-- name: GetPublisher :oneSELECT*FROMpublic.publishersWHERE id = $1LIMIT1;
Version
1.28.0
What happened?
I tried make example on playground as minimal for problem that I have. We have 3 schemas that was creating with 20+ migrations. We started using sqlc and generated models work and everything work for schema news as it's default schema, but isn't. I tried debug AST and looks that
news
schema is set as default and works only without prefix in queries that cause problem that we usepublic
default schema where is majority of tables and I need use whole path for table in queries but that throw error as in playground example.query.sql:1:1: relation "authors" does not exist
.Only working queries are
instead correct ones
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/b65c5f24c22d216b30dd0825b38e5560943f40ce7fe9bc3be7ddea1972c9becb
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: