sqlc
sqlc copied to clipboard
"relation does not exist" for foreign data wrapper table
Version
1.30.0
What happened?
Extra reproduction steps:
- clone this repo and apply the migrations
mkdir -p sqlc_gen/schema sqlc_gen/queriespg_dump --schema-only > schema/schema.sql
Relevant log output
# package db
sqlc_gen/schema/schema.sql:1:1: relation "raw_customer_data" does not exist
Database schema
-- first match when searching `:/raw_customer` in `schema.sql` opened in neovim
CREATE FOREIGN TABLE public.raw_customer_data (
key text,
val text
)
SERVER redis_server
OPTIONS (
tablekeyprefix 'jmp_customer_'
);
SQL queries
-- NOTE: no mention of raw_customer_data
-- name: GetSIM :one
SELECT * FROM sims
WHERE sim_id = $1 LIMIT 1;
-- name: ListSIMsByCustomer :many
SELECT * FROM sims
WHERE customer_id = $1
ORDER BY created_at DESC;
-- name: CreateSIM :one
INSERT INTO sims (
sim_id, customer_id, iccid, status
) VALUES (
$1, $2, $3, $4
)
RETURNING *;
-- name: UpdateSIMStatus :exec
UPDATE sims
SET status = $2
WHERE sim_id = $1;
-- name: GetSIMByICCID :one
SELECT * FROM sims
WHERE iccid = $1 LIMIT 1;
Configuration
version: "2"
sql:
- engine: "postgresql"
queries: "sqlc_gen/queries"
schema: "sqlc_gen/schema"
gen:
go:
package: "db"
out: "sqlc_gen/go"
sql_package: "pgx/v5"
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
FDWs are currently not supported. I'm working on adding support for a database-only analyzer which should work well with FDW and other advanced PostgreSQL features.