Can I dynamically set a Postgres schema for a table with a plugin? #6548
Unanswered
andrewhare
asked this question in
Q&A
Replies: 1 comment
-
I was able to do what I wanted by changing the for _, j := range db.Statement.Joins {
r := db.Statement.Schema.Relationships.Relations[j.Name]
r.FieldSchema.Table = s.prepend(ctx, r.FieldSchema.Table)
} Will this break anything else as the query is built? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to create a plugin that allows me to dynamically prefix a Postgres schema to any tables in the query. The schema name is pulled out of whatever
context.Context
was supplied with the query.This works for
SELECT
tables but not for tables referenced in aJOIN
. Is it possible to set the name of the joined table?Beta Was this translation helpful? Give feedback.
All reactions