Skip to content

create a column alias for COUNT(*) so that optional SQL::Abstract::More column quoting works#24

Open
djerius wants to merge 2 commits intoalranel:masterfrom
djerius:issue-23-fix-count-sql
Open

create a column alias for COUNT(*) so that optional SQL::Abstract::More column quoting works#24
djerius wants to merge 2 commits intoalranel:masterfrom
djerius:issue-23-fix-count-sql

Conversation

@djerius
Copy link
Copy Markdown

@djerius djerius commented Jul 8, 2025

The existing code passes the expression COUNT(*) to SQL::Abstract::More, which intepreted it as a column name and if its quote_char option was set, quoted it, leading to errors such as

DBD::Pg::st execute failed: ERROR: column "COUNT()" does not exist LINE 1: SELECT "COUNT()" FROM "temp0002" AS "me"
^ [for Statement "SELECT "COUNT(*)" FROM "temp0002" AS "me""]

This commit creates a column alias for COUNT(*), providing something appropriate for SQL::Abstract::More to quote.

…re column quoting works

The existing code passes the expression COUNT(*) to SQL::Abstract::More, which
intepreted it as a column name and if its quote_char option was set, quoted it,
leading to errors such as

DBD::Pg::st execute failed: ERROR:  column "COUNT(*)" does not exist
LINE 1: SELECT "COUNT(*)" FROM "temp0002" AS "me"
                ^ [for Statement "SELECT "COUNT(*)" FROM "temp0002" AS "me""]

This commit creates a column alias for COUNT(*), providing something appropriate for
SQL::Abstract::More to quote.
@djerius djerius force-pushed the issue-23-fix-count-sql branch from b793c09 to 453c8e7 Compare January 23, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant