mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:36:44 +00:00
fix: infer postgres field (#3663)
This commit is contained in:
parent
677eb152e0
commit
46daba1e6e
@ -34,7 +34,7 @@ describe('view inference', function () {
|
||||
|
||||
await db.sync();
|
||||
|
||||
const viewName = 'user_posts';
|
||||
const viewName = 'test_view';
|
||||
|
||||
const dropViewSQL = `DROP VIEW IF EXISTS ${viewName}`;
|
||||
await db.sequelize.query(dropViewSQL);
|
||||
|
@ -153,10 +153,14 @@ export default class PostgresQueryInterface extends QueryInterface {
|
||||
|
||||
// handle column alias
|
||||
const from = ast[0].from;
|
||||
const findAs = from.find((from) => from.as === columnExprTable);
|
||||
if (columnExprTable === null && column.expr.type === 'column_ref') {
|
||||
columnExprTable = from[0].table;
|
||||
} else {
|
||||
const findAs = from.find((from) => from.as === columnExprTable);
|
||||
|
||||
if (findAs) {
|
||||
columnExprTable = findAs.table;
|
||||
if (findAs) {
|
||||
columnExprTable = findAs.table;
|
||||
}
|
||||
}
|
||||
|
||||
return columnUsage.column_name === column.expr.column && columnUsage.table_name === columnExprTable;
|
||||
|
Loading…
Reference in New Issue
Block a user