Why does the query builder keep sending inaccurately parameters in my query?

I am using the query builder to run the following query.

However, when I print the query, it seems like the 2nd parameter is being passed instead of the 1st parameter. Can someone explain what I might be doing wrong here?

const queryRunner: QueryRunner = getConnection().createQueryRunner();

  await queryRunner.startTransaction();

  try {
    //other queries here deleted for simplicity
    await queryRunner.manager
      .getRepository(User)
      .createQueryBuilder()
      .update(User)
      .set({ status: UserStatus.INACTIVE }) // UserStatus is enum
      .where("organizationId IN(:...ids)", { ids: organizations })
      .printSql()
      .execute();

    await queryRunner.commitTransaction();
  } catch (err) {
    await queryRunner.rollbackTransaction();
    console.log("=====Rollback=====");
  } finally {
    await queryRunner.release();
  }

This is the output:

UPDATE "users" SET "status" = $2 WHERE "organizationId" IN($2, $3, $4, $5) -- PARAMETERS: ["INACTIVE",32,36,35,34]

Answer №1

After troubleshooting, I discovered that the root cause of the problem was not in my code, but rather a bug within typeorm version 0.2.25. Luckily, this issue has been resolved in the most recent update of the software.

If you want more information, check out this link: Github issues.

Many thanks!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to merge two rows into one by linking them through a specific cell in SQL?

Question: - I received 2 results from my query: SA01 | False | SA01 | False | No | Yes | [NULL] | VA - HRD 1 SA01 | False | SA01 | False | No | Yes | [NULL] | VA - NOVA 1 I am looking to combine them into one row with differ ...

Simplest method for converting a large XML file into a MySQL database

Looking for a way to convert a 63MB XML file containing a list of chess players into a MySQL database? The XML structure is as follows: <playerslist> <player> <fideid></fideid> <name></name> < ...

Is there a way for me to access the data stored in session storage in Next.js?

One of the components in my project is a slider, which allows users to set the number of columns in an Image Gallery component. This code snippet shows the implementation of the slider component: export default function Slider({ value, handleChange }: ISl ...

Is it possible to incorporate new models into Postgres without having to erase all existing tables in the database?

Python Framework Dilemma I've encountered a problem while attempting to introduce a new table/model from Django models into my pre-existing postgres database that already contains numerous tables. The only suggested solution seems to involve starting ...

Vue 3 TypeScript Error 2339: The attribute xxx is not present in the type {

My tech stack includes Vue3 with TypeScript, axios, and sequelize. Currently, I am working on a form that contains just one textarea for users to post on a wall. Below is the script I have written in my form component: <template> <div id="P ...

Looking to sporadically update a column with specifically enumerated values

I have a collection of values (not sequential) stored in TableB(id). My objective is to randomly assign these values to a column in TableA. Do you think this query will achieve the desired result? update TableA set column1 = (select id from TableB order ...

Is there a better approach to conducting a multi-table SQL query in MySQL?

I find myself in need of assistance. I am faced with a situation where I have three tables and I am attempting to craft a conditional query to filter out certain rows from one table, then querying another table based on the remaining results. Despite my ef ...

SQL pulling out content sandwiched between characters

I need help extracting a specific string between two characters where the length can vary for different numbers. The values I want to extract are like 0001A, 0002BB, 0003C, etc. Currently, using select SUBSTRING(ordtxt,7,4) as ordtxt, I am only able to ex ...

Choose a single payment from a list of customers with numerous payments

I manage a database table named "payments" to keep track of all the payments made by my clients. My current task involves calculating the non-payment rate for a specific month by executing a select query. In this table, customers can have multiple payment ...

Why is patchValue not functioning as expected? Is there another method that does the job

Encountering an issue with the image upload feature on a component form that consists of 8 entries - 7 text inputs and 1 image upload field. While all data is successfully submitted to the node server, the image upload function only sporadically works. Wh ...

Angular TypeScript state management system

I am facing a challenge in connecting a controller to a state (using angular ui.router) where one way of writing it works, while the other does not. Successful example (with the controller registered under the module): this.$stateProvider .state(' ...

The gathered data from MySQL GROUP_CONCAT contained repeated values, making it impossible to utilize DISTINCT

My query involves 5 tables that are connected using LEFT JOIN, and I am grouping some results with GROUP_CONCAT. The issue I am facing is that the results from GROUP_CONCAT are duplicating in the following columns: pedido_lentes pedidos_lente_quantidades ...

Angular does not permit the use of the property proxyConfig

Click here to view the image I encountered an issue when attempting to include a proxy config file in angular.json, as it was stating that the property is not allowed. ...

Issue with React hook forms and shadcn/ui element's forwardRef functionality

Greetings! I am currently in the process of creating a form using react-hook-form along with the help of shadcn combobox. In this setup, there are two essential files that play crucial roles. category-form.tsx combobox.tsx (This file is utilized within ...

Using SQL to perform an INSERT INTO operation with the SELECT statement and a string value

What is the best way to merge the following SQL statements? cNamesql = "SELECT ContactName FROM Contact WHERE Contact_ID = '0001'"; sql = "INSERT INTO PurchaseInfo (ContactName) VALUES ('Contact Name "+ cNamesql + "')'; For examp ...

How can one utilize the this.$q Quasar object within the setup() function in Vue 3 Composition API?

Here is a component script written in Options Api: <script> export default { data() { return { model: null, }; }, computed: { isMobile() { return this.$q.screen.xs || this.$q.screen.sm; } } }; </script> If y ...

Encountering NaN in the DOM while attempting to interpolate values from an array using ngFor

I am working with Angular 2 and TypeScript, but I am encountering NaN in the option tag. In my app.component.ts file: export class AppComponent { rooms = { type: [ 'Study room', 'Hall', 'Sports hall', ...

Is it possible to use TypeScript or Angular to disable or remove arrow key navigation from a PrimeNG Table programmatically?

Is there a way to programmatically prevent left and right arrow key navigation in a PrimeNG Table with cell editing, without the need to modify the Table component source code? You can check out an example here: Angular Primeng Tableedit Demo code. I mana ...

Issues with CSS Styling not being applied properly on mobile devices in a React App deployed on Heroku

The Dilemma My React app is deployed on Heroku using create-react-app for bundling. The backend is a Node.js written in Typescript with node version 10.15.3. Locally, when I run the site using npm start, everything works perfectly. However, when I view t ...

Callback does not modify the value

I am attempting to retrieve a result from a series of callback functions, but I am encountering an issue where no result is being returned at all. Below is the code snippet I am working with: Main function : let userldap:userLDAP = {controls:[],objectCl ...