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

No way to use rowid #61

Open
jkroso opened this issue May 11, 2024 · 1 comment
Open

No way to use rowid #61

jkroso opened this issue May 11, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jkroso
Copy link

jkroso commented May 11, 2024

render(conn, From(:anytable) |> Select(:rowid))

produces an error: ReferenceError: cannot find rowid

render(conn, From(:anytable) |> Select(“rowid"))

Almost works but it produces SELECT ‘rowid’ AS “_”

@xitology
Copy link
Member

FunSQL currently has no way to refer to ROWID or other pseudo-columns (e.g. oid in PostgreSQL).

There are some workarounds. One is to include ROWID as an actual column of the table in the FunSQL catalog. However, it will make the pseudo-column always appear in the output, which may not be necessarily what the user wants. Perhaps, we need a way to declare a column hidden, so that it can be used in expressions, but would not appear in the output by default.

Alternatively, one could refer to ROWID using function/operator notation: Fun("ROWID "). Note the trailing space to suppress parentheses. However, if the query has a JOIN, or the FROM clause is wrapped in a subquery, the generated SQL will be invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants