Skip to content

An alias of returning clause is dicarded in SqlStatement::ToString #14523

@ritalin

Description

@ritalin

What happens?

In following SQL:

INSERT INTO T (id) VALUES (1) RETURNING id AS inserted
  1. SQLStatement is extracted from Connection.
  2. Call SQLStatement::ToString method.

A SQL discarded alias of returning clause is returned.

To Reproduce

std::string sql("INSERT INTO T (id) VALUES (1) RETURNING id AS inserted");
auto stmts = conn.ExtractStatements(sql);

std::out << stmts[0]->ToString() << std::end;

Expected result:
INSERT INTO T (id) (VALUES (1)) RETURNING id AS inserted

Actual result:
INSERT INTO T (id) (VALUES (1)) RETURNING id

EDIT:
UPDATE and DELETE statements is also discarded it but not discribing about returning clause explicitly.

OS:

MacOS Ventura 13.6.7 (x86_64 16GB RAM)

DuckDB Version:

1.1.2

DuckDB Client:

C++

Hardware:

No response

Full Name:

Kazuhiko TAMURA

Affiliation:

No job

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have not tested with any build

Did you include all relevant data sets for reproducing the issue?

No - Other reason (please specify in the issue body)

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions