Skip to content

Named parameter validation throwing for quoted strings #6

Open
@mmkal

Description

@mmkal

Repro:

let {createPool, sql} = require('slonik')
const {raw} = require('slonik-sql-tag-raw')

let slonik = createPool('postgresql://postgres:postgres@localhost:5432/postgres')

const queryFromFileSystem = `
  select $$
    this is just a string, it should be able to have any value
    but this causes an error --> :foo:
  $$
`

slonik.query(sql`${raw(queryFromFileSystem)}`)

Running this throws an error: InvalidInputError: Named parameter reference does not have a matching value.

Edit: it also reproduces for single-quoted strings:

select '
  this is just a string, it should be able to have any value
  but this causes an error --> :foo:
'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions