mirror of
https://github.com/n8n-io/n8n.git
synced 2026-09-19 09:51:59 +08:00
feat(Postgres Node): Sort PostgreSQL schemas and tables alphabetically when fetching (#28036)
Co-authored-by: Garrit Franke <32395585+garritfra@users.noreply.github.com>
This commit is contained in:
co-authored by
Garrit Franke
parent
9345d132fa
commit
11ebf61471
@@ -9,7 +9,9 @@ export async function schemaSearch(this: ILoadOptionsFunctions): Promise<INodeLi
|
||||
|
||||
const { db } = await configurePostgres.call(this, credentials, options);
|
||||
|
||||
const response = await db.any('SELECT schema_name FROM information_schema.schemata');
|
||||
const response = await db.any(
|
||||
'SELECT schema_name FROM information_schema.schemata ORDER BY schema_name',
|
||||
);
|
||||
|
||||
return {
|
||||
results: response.map((schema) => ({
|
||||
@@ -18,6 +20,7 @@ export async function schemaSearch(this: ILoadOptionsFunctions): Promise<INodeLi
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
export async function tableSearch(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
|
||||
const credentials = await this.getCredentials<PostgresNodeCredentials>('postgres');
|
||||
const options = { nodeVersion: this.getNode().typeVersion };
|
||||
@@ -29,7 +32,7 @@ export async function tableSearch(this: ILoadOptionsFunctions): Promise<INodeLis
|
||||
}) as string;
|
||||
|
||||
const response = await db.any(
|
||||
'SELECT table_name FROM information_schema.tables WHERE table_schema=$1',
|
||||
'SELECT table_name FROM information_schema.tables WHERE table_schema=$1 ORDER BY table_name',
|
||||
[schema],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user