Skip to content

Wrap postgres column identifiers with quotes to handle reserved keywords#49

Open
nasmr wants to merge 3 commits intomainfrom
nas/postgres-quote-keyword
Open

Wrap postgres column identifiers with quotes to handle reserved keywords#49
nasmr wants to merge 3 commits intomainfrom
nas/postgres-quote-keyword

Conversation

@nasmr
Copy link
Copy Markdown

@nasmr nasmr commented Mar 30, 2026

Encountered this error when trying to use the postgres loader with the following SQL query
"SELECT * FROM \"edgeandnode/ethereum_mainnet@0.0.2\".transactions LIMIT 100"

Output:

Failed to load batch: INSERT operation failed: syntax error at or near "to"
LINE 1: ...ck_hash, block_num, timestamp, tx_index, tx_hash, to, nonce,...
                                                             ^

`FATAL: Permanent error loading batch (not retryable). Stopping client to prevent data loss. Error: INSERT operation failed: syntax error at or near "to"
LINE 1: ...ck_hash, block_num, timestamp, tx_index, tx_hash, to, nonce,...
                                                             ^

The operation was failing because the ethereum_mainnet dataset contained column names that were reserved SQL keywords like to, from, ...

This PR addresses this edge case by wrapping column names with " so that reserved keywords will not throw an error and loading operation can take place normally.

Successful output after fix applied:

ampPython-columnQuote

@nasmr nasmr requested review from fordN and incrypto32 March 30, 2026 21:12
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