-
Notifications
You must be signed in to change notification settings - Fork 0
Table
Christoph Herrmann edited this page Oct 17, 2019
·
3 revisions
const table = 'users'
const result = await sql.query(sql`
SELECT "*" FROM ${sql.table(table)}
`)
// text: SELECT "*" FROM "users"
// values: []It's also possible to define a schema by giving table as array, e.g.:
const schema = 'account'
const table = 'users'
const result = await sql.query(sql`
SELECT "*" FROM ${sql.table([schema, table])}
`)
// text: SELECT "*" FROM "account"."users"
// values: []If all tables are in the same schema, there is also the option sql.defaultSchema.
Found a bug or missing a feature? -> Create a new Issue
Found a security issue? -> Look at the Security Policy
Having questions, want to give feedback or talk to me? -> E-Mail me sql-pg@sharaal.de