Skip to content

Unable to send multiple SQL commands in one simpleQuery #499

Description

@MahdiBM

Describe the issue

Unable to send multiple SQL commands in one simpleQuery.

Vapor version

1.21.5

Operating system and version

macOS 15

Swift version

swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10) Target: arm64-apple-macosx15.0

Steps to reproduce

let db: PostgresDatabase = ...
_ = try await db.simpleQuery("""
SELECT current_setting('application_name');
SELECT current_setting('something_else');
""").get()

Outcome

server: cannot insert multiple commands into a prepared statement (exec_parse_message)

Additional notes

Postgres documentation mentions that multiple SQL commands in one simple query is allowed:

A simple query cycle is initiated by the frontend sending a Query message to the backend. The message includes an SQL command (or commands) expressed as a text string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions