Skip to content

Commit

Permalink
fix: table autocomplete should pass catalog (apache#28413)
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida authored May 9, 2024
1 parent 307ebea commit e516bba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const fakeFunctionNamesApiResult = {
};

const expectDbId = 1;
const expectCatalog = null;
const expectSchema = 'schema1';

beforeEach(() => {
Expand Down Expand Up @@ -228,7 +229,12 @@ test('returns column keywords among selected tables', async () => {
),
);
storeWithSqlLab.dispatch(
addTable({ id: expectQueryEditorId }, expectTable, expectSchema),
addTable(
{ id: expectQueryEditorId },
expectTable,
expectCatalog,
expectSchema,
),
);
});

Expand Down Expand Up @@ -267,7 +273,12 @@ test('returns column keywords among selected tables', async () => {

act(() => {
storeWithSqlLab.dispatch(
addTable({ id: expectQueryEditorId }, unexpectedTable, expectSchema),
addTable(
{ id: expectQueryEditorId },
unexpectedTable,
expectCatalog,
expectSchema,
),
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ export function useKeywords(

const insertMatch = useEffectEvent((editor: Editor, data: any) => {
if (data.meta === 'table') {
dispatch(addTable({ id: queryEditorId, dbId }, data.value, schema));
dispatch(
addTable({ id: queryEditorId, dbId }, data.value, catalog, schema),
);
}

let { caption } = data;
Expand Down

0 comments on commit e516bba

Please sign in to comment.