question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Replace BindParameter ? with $1 does not work in INSERT VALUES ?

See original GitHub issue

SQLDelight Version

2.0.0-alpha04

Operating System

macOS

Gradle Version

7.5.1

Kotlin Version

1.7.20

Dialect

Postgresql

AGP Version

No response

Describe the Bug

While #3375 adds support to replace ? to $1 in code generating, https://github.com/cashapp/sqldelight/pull/3375#discussion_r934996801, this does not work when sqldelight replaces a single ? with multiple ? in an insert statement:

insert:
INSERT INTO foo VALUES ?;

Results into: INSERT INTO foo VALUES (?, ?, ?), but should be: INSERT INTO foo VALUES ($1, $2, $3) too.

Stacktrace

No response

Gradle Build Script

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hfhbdcommented, Nov 5, 2022

@sachera I would suggest creating the PR and we can discuss it there.

0reactions
sacheracommented, Nov 11, 2022

Done: #3662

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to insert values using column name with space?
INSERT INTO table_name VALUES (:param_x, :param_y) will only work if the table is defined with column "x" followed by column "y". It won't...
Read more >
SQLBindParameter Function - ODBC API Reference
This function replaces the ODBC 1.0 function SQLSetParam. ... All parameters in SQL statements that do not call procedures, such as INSERT ......
Read more >
SQL Bind Variables/Parameters in Databases
When using bind parameters you do not write the actual values but instead insert placeholders into the SQL statement. That way the statements...
Read more >
PDOStatement::bindParam - Manual - PHP
Example #1 Execute a prepared statement with named placeholders. <?php ... This can cause problems when trying to compare values using the ===...
Read more >
5 Binding and Defining
If you change only the value of a bind variable, it is not necessary to rebind ... conversion. insert into t (c2) values...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found