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

Data type STRING not recognized #14

Open
MFAshby opened this issue Apr 7, 2022 · 1 comment
Open

Data type STRING not recognized #14

MFAshby opened this issue Apr 7, 2022 · 1 comment

Comments

@MFAshby
Copy link

MFAshby commented Apr 7, 2022

Hi,

I'm experimenting with postgresql-parser to intercept and rewrite some queries to a postgresql database.

One problem I have encountered is that the formatter will output "STRING" by default for string data type. PostgreSQL does not support this, instead the data type name is "TEXT". CockroachDB supports "TEXT" as an alias for "STRING" [1]

In order to make query-rewriting work, I've patched postgresql-parser to output "TEXT" data type by default instead of "STRING". I think this could be a reasonable default since CockroachDB supports both.

[1] https://www.cockroachlabs.com/docs/stable/string.html

@gohashira
Copy link

I dont think it's a reasonable default since "TEXT" doesn't have size constraints, it's a string of any length.
Cockroach's "STRING" datatype can be limited by doing "STRING(X)"

https://www.postgresql.org/docs/current/datatype-character.html

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