Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic column selection with column naming alias is not working #849

Closed
benjamin79 opened this issue Apr 18, 2024 · 1 comment
Closed

Comments

@benjamin79
Copy link

Hi,

i have an array (columnsToSelect) of columns to which i want add another one

columnsToSelect.push("(firstname || ' ' || lastname) as fullname");

SELECT ${sql(columnsToSelect)} FROM ${sql(table)}

I tried different combinations with " and ' but without success.

error:
missing FROM-clause entry for table

Is this possible?

thanks

@porsager
Copy link
Owner

You need to use fragments to create the as ? parts.

https://github.com/porsager/postgres?tab=readme-ov-file#building-queries

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

No branches or pull requests

2 participants