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

postgresql "SELECT 'x'" where x is character string fails without specifying type conversion #369

Open
mcrumiller opened this issue Sep 30, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@mcrumiller
Copy link

What language are you using?

Python 3.9.5

What database are you using?

PostgreSQL, Oracle, MSSQL Server

Can you describe your bug?

Selecting a constant string fails unless the string type (text/varchar/char) is specified.

What are the steps to reproduce the behavior?

import connectorx as cx
conn = ... # setup your connection string
cx.read_sql(conn, "SELECT 1 AS value")            # suceeds
cx.read_sql(conn, "SELECT True AS value")         # suceeds
cx.read_sql(conn, "SELECT 'Y' AS value")          # fails
cx.read_sql(conn, "SELECT 'Y'::CHAR AS value")    # succeeds
cx.read_sql(conn, "SELECT 'Y'::VARCHAR AS value") # succeeds
cx.read_sql(conn, "SELECT 'Y'::TEXT AS value")    # succeeds

What is the error?

thread '<unnamed>' panicked at 'not implemented: unknown', D:\a\connector-x\connector-x\connectorx\src\sources\postgres\typesystem.rs:100:22
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Projects\project-slim\venv_slim\lib\site-packages\connectorx\__init__.py", line 224, in read_sql
    result = _read_sql(
pyo3_runtime.PanicException: not implemented: unknown

Show the error result here.

@mcrumiller mcrumiller added the bug Something isn't working label Sep 30, 2022
@wangxiaoying
Copy link
Contributor

Hi @mcrumiller , that's weird I tried query SELECT 'Y' AS a on my local postgres instance in it works with the following result:
image

Is it related to the setup of the db? I'm using official docker image of postgres locally.

@mcrumiller
Copy link
Author

@wangxiaoying that is odd indeed. I'll add that I'm using Greenplum, which is a fork of Postgres.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants