Skip to content

Commit 8411515

Browse files
committed
Making the new queries work
1 parent 019ebfe commit 8411515

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/api/schemas.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ Promise<{ data: Interfaces.Schema[]; error: null | Error }> {
2525
try {
2626
let query = SQL``.append(allSchemasSql)
2727
if (!include_system_schemas) {
28-
query.append(` and schema_name not in (${defaultSchemasList})`)
29-
console.log('query', query)
28+
query.append(` and n.nspname not in (${defaultSchemasList})`)
3029
}
3130
const { data, error } = await RunQuery<Interfaces.Schema>(connection, query)
3231
if (error) throw error
@@ -48,7 +47,7 @@ export async function byId(
4847
): /** Returns a single schemas */
4948
Promise<{ data: Interfaces.Schema; error: null | Error }> {
5049
try {
51-
const query = SQL``.append(allSchemasSql).append(SQL` where nsp.oid = ${id}`)
50+
const query = SQL``.append(allSchemasSql).append(SQL` and nsp.oid = ${id}`)
5251
const { data } = await RunQuery<Interfaces.Schema>(connection, query)
5352
return { data: data[0], error: null }
5453
} catch (error) {
@@ -68,7 +67,7 @@ export async function byName(
6867
): /** Returns a single schemas */
6968
Promise<{ data: Interfaces.Schema; error: null | Error }> {
7069
try {
71-
const query = SQL``.append(allSchemasSql).append(SQL` where schema_name = ${name}`)
70+
const query = SQL``.append(allSchemasSql).append(SQL` and n.nspname = ${name}`)
7271
const { data } = await RunQuery<Interfaces.Schema>(connection, query)
7372
return { data: data[0], error: null }
7473
} catch (error) {

0 commit comments

Comments
 (0)