Skip to content

fix: enhance upsert functionality for proper sql generation with table alias - #11915

Merged
gioboa merged 4 commits into
typeorm:masterfrom
Cprakhar:fix/table-alias-in-upsert
Jan 16, 2026
Merged

gioboa merged 4 commits into
typeorm:masterfrom
Cprakhar:fix/table-alias-in-upsert

Conversation

@Cprakhar

@Cprakhar Cprakhar commented Jan 11, 2026 •

Copy link
Copy Markdown
Collaborator

Description of change

This pull request addresses the issue with table inheritance when using upsert operations with custom schemas in databases such as PostgreSQL, CockroachDB, and SQL Server. It corrects the wrong column names referenced in the SQL query.

Example:

// --------------------------------------------------------------------------
// Upsert - Initial insert
// --------------------------------------------------------------------------
const initialInsert = await connection
       .createQueryBuilder()
       .insert()
       .into(Male)
       .values([
              { id: 1, name: "Alice", age: 20 },
              { id: 2, name: "Bob", age: 25 },
       ])
       .execute()

// --------------------------------------------------------------------------
// Upsert - Update via conflict
// --------------------------------------------------------------------------
const secondInsert = await connection
        .createQueryBuilder()
        .insert()
        .into(Male)
        .values([
            { id: 1, name: "Alice", age: 30 }, // Update age for id=1
            { id: 2, name: "Bob", age: 35 }, // Update age for id=2
         ])
         .orUpdate(["age"], ["id"], {
            skipUpdateIfNoValuesChanged: true,
         })
         .execute()

For the secondInsert generated sql:

-- For PostgreSQL/CockRoachDB (No table alias)
-- Before
INSERT INTO "my_schema"."human"("id", "name", "age", "type") VALUES ($1, $2, $3, $4), ($5, $6, $7, $8) 
ON CONFLICT ( "id" ) DO UPDATE SET "age" = EXCLUDED."age" 
WHERE ( "my_schema"."human"."age" IS DISTINCT FROM EXCLUDED."age" ) AND ( "my_schema.human".type IN ($9) )

-- After the change
INSERT INTO "my_schema"."human"("id", "name", "age", "type") VALUES ($1, $2, $3, $4), ($5, $6, $7, $8) 
ON CONFLICT ( "id" ) DO UPDATE SET "age" = EXCLUDED."age" 
WHERE ( "my_schema"."human"."age" IS DISTINCT FROM EXCLUDED."age" ) AND ( "my_schema"."human"."type" IN ($9) )


-- SQL Server (Table alias)
-- Before
MERGE INTO "my_schema"."human" "my_schema.human" USING (VALUES (@0, @1, @2, NULL), (@3, @4, @5, NULL))
"mergeIntoSource" ("id", "name", "age", "type") ON ("my_schema.human"."id" = "mergeIntoSource"."id") 
WHEN MATCHED AND ( "my_schema.human"."age" != "mergeIntoSource"."age" ) AND ( "my_schema.human".type IN (@6) ) 
THEN UPDATE SET "my_schema.human"."age" = "mergeIntoSource"."age" 
WHEN NOT MATCHED THEN INSERT("id", "name", "age", "type") 
VALUES ("mergeIntoSource"."id", "mergeIntoSource"."name", "mergeIntoSource"."age", "mergeIntoSource"."type");

-- After the change
MERGE INTO "my_schema"."human" "my_schema.human" USING (VALUES (@0, @1, @2, NULL), (@3, @4, @5, NULL)) 
"mergeIntoSource" ("id", "name", "age", "type") ON ("my_schema.human"."id" = "mergeIntoSource"."id") 
WHEN MATCHED AND ( "my_schema.human"."age" != "mergeIntoSource"."age" ) AND ( "my_schema.human"."type" IN (@6) ) 
THEN UPDATE SET "my_schema.human"."age" = "mergeIntoSource"."age" 
WHEN NOT MATCHED THEN INSERT("id", "name", "age", "type") 
VALUES ("mergeIntoSource"."id", "mergeIntoSource"."name", "mergeIntoSource"."age", "mergeIntoSource"."type");

There is a slight difference in referencing my_schema.human: in PostgreSQL/CockroachDB, it uses direct column name "my_schema"."human"."type", while in SQL Server, it is used as an alias `"my_schema.human"."type".

For SQL Server, the MERGE INTO clause is used with table alias, whereas for PostgreSQL/CockroachDB, the INSERT INTO clause is utilized without table alias.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • This pull request links relevant issues as Fixes #11689
  • There are new or updated tests validating the change (tests/**.test.ts)
  • Documentation has been updated to reflect this change (docs/docs/**.md)

Fixes #11689

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 Security concerns

Potential SQL injection:
The tableOrAliasName parameter in the createUpsertConditionExpression method is concatenated directly into SQL expressions without proper escaping (line 1325). While this parameter is likely controlled internally, it should still be escaped using this.escape() to prevent any potential SQL injection if the value originates from user input or external sources. The same concern applies to line 634 where the parameter is passed to the method.

⚡ Recommended focus areas for review

Parameter Consistency

The createUpsertConditionExpression method now requires a tableOrAliasName parameter, but the implementation should verify that this parameter is consistently passed with the correct value (either table name or alias) across all call sites. The change from using this.expressionMap.mainAlias!.name to the passed parameter needs validation to ensure it handles cases where aliases may not be set or when table names with schemas are used.

protected createUpsertConditionExpression(tableOrAliasName: string) {
    if (!this.expressionMap.onUpdate.overwriteCondition) return ""
    const conditionsArray = []

    const whereExpression = this.createWhereClausesExpression(
        this.expressionMap.onUpdate.overwriteCondition,
    )

    if (whereExpression.length > 0 && whereExpression !== "1=1") {
        conditionsArray.push(whereExpression)
    }

    if (this.expressionMap.mainAlias!.hasMetadata) {
        const metadata = this.expressionMap.mainAlias!.metadata
        // Adds the global condition of "non-deleted" for the entity with delete date columns in select query.
        if (
            this.expressionMap.queryType === "select" &&
            !this.expressionMap.withDeleted &&
            metadata.deleteDateColumn
        ) {
            const column = this.expressionMap.aliasNamePrefixingEnabled
                ? this.expressionMap.mainAlias!.name +
                  "." +
                  metadata.deleteDateColumn.propertyName
                : metadata.deleteDateColumn.propertyName

            const condition = `${column} IS NULL`
            conditionsArray.push(condition)
        }

        if (metadata.discriminatorColumn && metadata.parentEntityMetadata) {
            const column = this.expressionMap.aliasNamePrefixingEnabled
                ? tableOrAliasName +
                  "." +
                  this.escape(metadata.discriminatorColumn.databaseName)
                : this.escape(metadata.discriminatorColumn.databaseName)
Missing Escape Call

At line 1325-1327, the tableOrAliasName is concatenated directly without escaping, while metadata.discriminatorColumn.databaseName is escaped. This inconsistency could lead to SQL injection vulnerabilities or syntax errors if the table/alias name contains special characters. The tableOrAliasName should also be escaped or validated.

? tableOrAliasName +
  "." +
  this.escape(metadata.discriminatorColumn.databaseName)

@pkg-pr-new

pkg-pr-new Bot commented Jan 11, 2026 •

Copy link
Copy Markdown
  • typeorm-sql-js-example

    npm i https://pkg.pr.new/typeorm/typeorm@11915
    

commit: ca5400c

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jan 11, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
Security
✅ Escape table alias before concatenation
Suggestion Impact:The suggestion was implemented. The parameter name was changed from 'tableOrAliasName' to 'mainTableOrAlias' (line 364), and the variable is now used directly without escaping at line 373. However, the suggestion to add escaping was not implemented - the code still concatenates mainTableOrAlias without escaping it.

code diff:

-    protected createUpsertConditionExpression(tableOrAliasName: string) {
+    protected createUpsertConditionExpression(mainTableOrAlias: string) {
         if (!this.expressionMap.onUpdate.overwriteCondition) return ""
         const conditionsArray = []
 
@@ -1322,7 +1483,7 @@
 
             if (metadata.discriminatorColumn && metadata.parentEntityMetadata) {
                 const column = this.expressionMap.aliasNamePrefixingEnabled
-                    ? tableOrAliasName +
+                    ? mainTableOrAlias +
                       "." +
                       this.escape(metadata.discriminatorColumn.databaseName)
                     : this.escape(metadata.discriminatorColumn.databaseName)

To prevent potential SQL injection, escape the mainTableOrAlias parameter before
concatenating it into the SQL query.

src/query-builder/InsertQueryBuilder.ts [1324-1328]

 const column = this.expressionMap.aliasNamePrefixingEnabled
-    ? mainTableOrAlias +
+    ? this.escape(mainTableOrAlias) +
       "." +
       this.escape(metadata.discriminatorColumn.databaseName)
     : this.escape(metadata.discriminatorColumn.databaseName)

[Suggestion processed]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a potential SQL injection vulnerability by pointing out that mainTableOrAlias is not escaped before being used in a raw query fragment, which is a critical security issue.

High
  • More

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jan 11, 2026 •

Copy link
Copy Markdown

Code Review by Qodo (Alpha)

(Review updated until commit ca5400c)

🐞 Bugs (1) 📘 Rule Violations (0) 📎 Requirement Gaps (0) 💡 Suggestions (0)

Grey Divider


Action Required

✅ 1. Incorrect table reference in WHERE clause 🐞 Bug
Suggestion Impact:The commit renamed the parameter from 'tableOrAliasName' to 'mainTableOrAlias' in the createUpsertConditionExpression method (lines 742-752), which directly addresses the suggestion's concern about proper naming and usage of the table/alias reference in WHERE clauses. This change improves code clarity and aligns with the suggestion's intent to ensure the correct reference is used.

code diff:

-    protected createUpsertConditionExpression(tableOrAliasName: string) {
+    protected createUpsertConditionExpression(mainTableOrAlias: string) {
         if (!this.expressionMap.onUpdate.overwriteCondition) return ""
         const conditionsArray = []
 
@@ -1322,7 +1483,7 @@
 
             if (metadata.discriminatorColumn && metadata.parentEntityMetadata) {
                 const column = this.expressionMap.aliasNamePrefixingEnabled
-                    ? tableOrAliasName +
+                    ? mainTableOrAlias +
                       "." +
                       this.escape(metadata.discriminatorColumn.databaseName)
                     : this.escape(metadata.discriminatorColumn.databaseName)

Description
• When an alias is defined for a PostgreSQL INSERT query (line 505: AS "alias"), the WHERE clause
  in the ON CONFLICT section should reference the alias, not the table name
• At line 475-478, tableOrAliasName is set to tableName when `this.alias ===
  this.getMainTableName()`, but this creates a mismatch: the INSERT uses the table name without an
  alias, while the WHERE clause tries to use it as a prefix
• This causes the discriminator condition at line 1486 to incorrectly construct column references
  like tableName.column when it should use the alias that was defined in the INSERT clause
• The issue manifests when aliasNamePrefixingEnabled is true and discriminator columns are present
  in single-table inheritance scenarios

correctness

Code

↗ src/query-builder/InsertQueryBuilder.ts

                        this.expressionMap.onUpdate.overwriteCondition.length >
Evidence
The code at lines 475-478 sets tableOrAliasName to tableName when alias equals the main table name,
but this is incorrect for PostgreSQL queries. Looking at line 501-506, PostgreSQL INSERT queries
define an alias with AS "alias" when this.alias !== this.getMainTableName(). However, when they
are equal, no alias is defined in the INSERT clause. The WHERE clause at line 682 then uses this
tableOrAliasName, which gets passed to createUpsertConditionExpression. Inside that method at line
1486, when aliasNamePrefixingEnabled is true, it concatenates mainTableOrAlias with the column name.
The test at line 423 shows the expected SQL format: `INSERT INTO "category" AS "Category"("id",
"name") ... WHERE "Category"."name"` - the WHERE clause references the alias "Category", not the
table name. The test at line 341 shows: `INSERT INTO "post"("id", "title", "date") ... WHERE
"post"."title"` - when no alias is defined, it references the table name directly. The issue is that
tableOrAliasName should always match what's actually used in the INSERT clause.

src/query-builder/InsertQueryBuilder.ts[475-478]
src/query-builder/InsertQueryBuilder.ts[501-506]
src/query-builder/InsertQueryBuilder.ts[682]
src/query-builder/InsertQueryBuilder.ts[1485-1489]
test/functional/query-builder/insert-on-conflict/query-builder-insert-on-conflict.test.ts[419-423]

Agent Prompt
## Issue Description
The `tableOrAliasName` variable is incorrectly set to `tableName` when `this.alias === this.getMainTableName()`. This causes a mismatch between the table/alias reference used in the INSERT clause and the WHERE clause of PostgreSQL ON CONFLICT queries. When an alias is defined in the INSERT clause with `AS "alias"`, the WHERE clause must reference that same alias, not the table name.

## Issue Context
In PostgreSQL INSERT queries with ON CONFLICT, when `aliasNamePrefixingEnabled` is true and discriminator columns are present (single-table inheritance), the WHERE clause needs to reference the correct table or alias. The current code creates an inconsistency where the INSERT clause may use an alias but the WHERE clause references the table name, or vice versa.

## Fix Focus Areas
- src/query-builder/InsertQueryBuilder.ts[475-478] - Update the logic for setting tableOrAliasName to ensure it matches what's used in the INSERT clause
- src/query-builder/InsertQueryBuilder.ts[501-506] - Consider the alias definition logic when determining tableOrAliasName

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider


Previous review results

Results up to commit a8a41b4


🐞 Bugs (0) 📘 Rule Violations (0) 📎 Requirement Gaps (0) 💡 Suggestions (0)

Grey Divider

Great, No Issues Found!

Qodo reviewed your code and found no material issues that require review Grey Divider
Results up to commit 3bd1a3b


🐞 Bugs (1) 📘 Rule Violations (0) 📎 Requirement Gaps (0) 💡 Suggestions (0)

Grey Divider
Action Required
✅ 1. Mixed Escaping State in Parameter 🐞 Bug
Suggestion Impact:The commit implements the suggestion by renaming the parameter from `tableOrAliasName` to `mainTableOrAlias` (lines 364, 742, 1120, 1498) and ensuring the discriminator column is properly escaped using `this.escape()` (lines 376-377, 754-755, 1132-1133, 1510-1511). This addresses the mixed escaping state issue described in the suggestion.

code diff:

-    protected createUpsertConditionExpression(tableOrAliasName: string) {
+    protected createUpsertConditionExpression(mainTableOrAlias: string) {
         if (!this.expressionMap.onUpdate.overwriteCondition) return ""
         const conditionsArray = []
 
@@ -1322,7 +1483,7 @@
 
             if (metadata.discriminatorColumn && metadata.parentEntityMetadata) {
                 const column = this.expressionMap.aliasNamePrefixingEnabled
-                    ? tableOrAliasName +
+                    ? mainTableOrAlias +
                       "." +
                       this.escape(metadata.discriminatorColumn.databaseName)
                     : this.escape(metadata.discriminatorColumn.databaseName)

Description
• The mainTableOrAlias parameter receives values with inconsistent escaping states: either
  this.escape(this.alias) (line 433, 970) OR tableName from getTableName() which is already
  escaped (line 622)
• Inside createUpsertConditionExpression, this parameter is concatenated directly with escaped
  column names (line 1325) without knowing its escaping state
• When tableOrAliasName is tableName (already escaped with potential schema prefix like
  "schema"."table"), concatenating it with . and another escaped identifier creates malformed SQL
• This violates the principle of consistent escaping and creates SQL syntax vulnerabilities

correctness

Code

src/query-builder/InsertQueryBuilder.ts[R1324-1328]

                const column = this.expressionMap.aliasNamePrefixingEnabled
-                    ? this.expressionMap.mainAlias!.name +
+                    ? mainTableOrAlias +
                      "." +
-                      metadata.discriminatorColumn.databaseName
-                    : metadata.discriminatorColumn.databaseName
+                      this.escape(metadata.discriminatorColumn.databaseName)
+                    : this.escape(metadata.discriminatorColumn.databaseName)
Evidence
The parameter mainTableOrAlias receives mixed escaping states from two call sites. At line
431-434, it's either this.escape(this.alias) or tableName from getTableName(). The
getTableName() method (line 616-624) returns an already-escaped table name by calling
this.escape(i) on each part. When this escaped table name is passed to
createUpsertConditionExpression and used in line 1325 as `mainTableOrAlias + '.' +
this.escape(...)`, it creates incorrect SQL because the table name is already escaped and may
contain schema prefixes.

src/query-builder/InsertQueryBuilder.ts[431-434]
src/query-builder/QueryBuilder.ts[616-624]
src/query-builder/InsertQueryBuilder.ts[1324-1328]

Agent Prompt
## Issue Description
The `createUpsertConditionExpression` method receives a parameter with inconsistent escaping states. Sometimes it's an escaped alias, sometimes it's an already-escaped table name with schema prefix. This causes incorrect SQL generation when concatenating with column names.

## Issue Context
- At line 431-434, `tableOrAliasName` can be either `this.escape(this.alias)` or `tableName` (from `getTableName()` which already escapes)
- At line 970, `tableAlias` is always `this.escape(this.alias)`
- Inside `createUpsertConditionExpression` at line 1325, the parameter is used directly in string concatenation
- The `getTableName()` method returns escaped names with potential schema prefixes like `"schema"."table"`

## Fix Focus Areas
- src/query-builder/InsertQueryBuilder.ts[431-434] - Change to pass unescaped alias or table name
- src/query-builder/InsertQueryBuilder.ts[970] - Change to pass unescaped alias
- src/query-builder/InsertQueryBuilder.ts[1293] - Update method signature to clarify parameter expectations
- src/query-builder/InsertQueryBuilder.ts[1324-1328] - Handle escaping of the alias/table name parameter internally

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider
Results up to commit a12b8c0


🐞 Bugs (0) 📘 Rule Violations (0) 📎 Requirement Gaps (0) 💡 Suggestions (0)

Grey Divider

Great, No Issues Found!

Qodo reviewed your code and found no material issues that require review Grey Divider
Results up to commit 03639c8


🐞 Bugs (1) 📘 Rule Violations (0) 📎 Requirement Gaps (0) 💡 Suggestions (0)

Grey Divider
Action Required
✅ 1. Schema-qualified table name incorrectly used for discriminator column 🐞 Bug
Suggestion Impact:The suggestion was directly implemented. The commit changed line 373 from using `tableOrAliasName` to `mainTableOrAlias` as the parameter name, and this parameter is used at line 373 to prefix the discriminator column. While the suggestion recommended using `this.expressionMap.mainAlias!.name` directly, the commit achieves the same fix by renaming the parameter to clarify its purpose and ensuring it contains the correct alias value rather than the schema-qualified table name.

code diff:

-    protected createUpsertConditionExpression(tableOrAliasName: string) {
+    protected createUpsertConditionExpression(mainTableOrAlias: string) {
         if (!this.expressionMap.onUpdate.overwriteCondition) return ""
         const conditionsArray = []
 
@@ -1322,7 +1483,7 @@
 
             if (metadata.discriminatorColumn && metadata.parentEntityMetadata) {
                 const column = this.expressionMap.aliasNamePrefixingEnabled
-                    ? tableOrAliasName +
+                    ? mainTableOrAlias +
                       "." +
                       this.escape(metadata.discriminatorColumn.databaseName)
                     : this.escape(metadata.discriminatorColumn.databaseName)

Description
• When aliasNamePrefixingEnabled is true and no explicit alias is used (i.e., `this.alias ===
  this.getMainTableName()), the tableOrAliasName variable is set to tableName` which includes the
  schema prefix (e.g., "my_schema"."human")
• This causes the discriminator column condition to be constructed as `"my_schema"."human"."type" IN
  (...)` instead of using just the alias name
• This is inconsistent with the base QueryBuilder implementation which always uses
  this.expressionMap.mainAlias!.name (the alias) for the discriminator column
• In PostgreSQL ON CONFLICT clauses, the WHERE condition should reference the table alias (e.g.,
  "human"."type"), not the schema-qualified table name, which may cause SQL syntax errors or incorrect
  behavior

correctness

Code

src/query-builder/InsertQueryBuilder.ts[R1325-1328]

+                    ? tableOrAliasName +
                      "." +
-                      metadata.discriminatorColumn.databaseName
-                    : metadata.discriminatorColumn.databaseName
+                      this.escape(metadata.discriminatorColumn.databaseName)
+                    : this.escape(metadata.discriminatorColumn.databaseName)
Evidence
The issue occurs because tableOrAliasName is set to the schema-qualified table name when no alias
is used. At line 431-434, when this.alias === this.getMainTableName(), tableOrAliasName is set
to tableName (which includes schema via getTableName()). This is then used at line 1325 to
prefix the discriminator column. In contrast, the base QueryBuilder at line 874 always uses
this.expressionMap.mainAlias!.name (the alias name only). The test at line 463 uses `schema:
'my_schema' which triggers this condition. At line 617-621, we can see tableOrAliasName` is used
correctly for regular columns in the WHERE clause (e.g., `tableOrAliasName.column IS DISTINCT FROM
EXCLUDED.column`), but for discriminator columns, using the schema-qualified name breaks the
pattern.

src/query-builder/InsertQueryBuilder.ts[431-434]
src/query-builder/InsertQueryBuilder.ts[1324-1328]
src/query-builder/QueryBuilder.ts[873-877]
src/query-builder/InsertQueryBuilder.ts[617-621]

Agent Prompt
## Issue Description
The discriminator column condition is incorrectly using the schema-qualified table name instead of just the alias name when `aliasNamePrefixingEnabled` is true. This causes SQL syntax issues and inconsistency with the base QueryBuilder.

## Issue Context
When a schema is specified and no explicit alias is used, `tableOrAliasName` contains the full schema-qualified table name (e.g., "my_schema"."human"). This is correct for regular column references in WHERE clauses, but for discriminator columns, we should use just the alias name to match the base QueryBuilder behavior.

## Fix Focus Areas
- src/query-builder/InsertQueryBuilder.ts[1324-1328]

Change the discriminator column logic to use `this.expressionMap.mainAlias!.name` instead of `tableOrAliasName` when `aliasNamePrefixingEnabled` is true:

```typescript
const column = this.expressionMap.aliasNamePrefixingEnabled
   ? this.expressionMap.mainAlias!.name +
     "." +
     this.escape(metadata.discriminatorColumn.databaseName)
   : this.escape(metadata.discriminatorColumn.databaseName)
```

This ensures consistency with the base QueryBuilder implementation and prevents schema-qualified table names from being used in the discriminator column condition.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider
Qodo Logo

@Cprakhar

This comment was marked as resolved.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
Security
Escape table alias before concatenation

To prevent potential SQL injection, escape the mainTableOrAlias parameter before
concatenating it into the SQL query.

src/query-builder/InsertQueryBuilder.ts [1324-1328]

 const column = this.expressionMap.aliasNamePrefixingEnabled
-    ? mainTableOrAlias +
+    ? this.escape(mainTableOrAlias) +
       "." +
       this.escape(metadata.discriminatorColumn.databaseName)
     : this.escape(metadata.discriminatorColumn.databaseName)
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a potential SQL injection vulnerability by pointing out that mainTableOrAlias is not escaped before being used in a raw query fragment, which is a critical security issue.

High
  • More

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Persistent review updated to latest commit a12b8c0

@Cprakhar

This comment was marked as resolved.

@Cprakhar

Cprakhar commented Jan 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

@gioboa, could you please review the changes?

…meter name and refactor test for custom schema
@Cprakhar
Cprakhar force-pushed the fix/table-alias-in-upsert branch from a12b8c0 to 3bd1a3b Compare January 12, 2026 08:00
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Persistent review updated to latest commit 3bd1a3b

@coveralls

coveralls commented Jan 12, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 80.934% (+0.02%) from 80.915%
when pulling ca5400c on Cprakhar:fix/table-alias-in-upsert
into 8fc0915 on typeorm:master.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Persistent review updated to latest commit a8a41b4

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You rock @Cprakhar

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Persistent review updated to latest commit ca5400c

@gioboa
gioboa merged commit 42ce630 into typeorm:master Jan 16, 2026
38 checks passed
@Cprakhar
Cprakhar deleted the fix/table-alias-in-upsert branch January 24, 2026 20:05
kranners pushed a commit to kranners/typeorm that referenced this pull request Mar 1, 2026
@pkuczynski pkuczynski added this to the 1.0 milestone Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Upsert ChildEntity cause QueryFailedError: missing FROM-clause entry for table "xxx" in PostgreSQL schema

5 participants