to_sql with postgres fails silently when given uppercase/capitalized table names #26030
Labels
IO SQL
to_sql, read_sql, read_sql_query
Needs Info
Clarification about behavior needed to assess issue
I attempted to use
to_sql
to insert into a Postgres table with a non-lowercase identifier. No error was raised in python, but the insert did not succeed:When I check the psql console, the 'tmp2' table is populated, but there is no 'tmp1' or 'TMP3' table:
Problem description
This MWE was tested with Postgres 11.2 on OSX 10.14.4 and with Postgres 9.5.15 on Red Hat 4.8.3-9.
The most related issue I saw was #7815, but I didn't understand its resolution. It sounded to me as though a subsequent release would have
to_sql
check which table was created/updated, if any, and return a warning on mismatch with its name parameter, but I did not observe comparable behavior.Expected Output
I would expect either a successful insert or an exception.
Output of
pd.show_versions()
pandas: 0.23.4
pytest: 4.0.2
pip: 18.1
setuptools: 40.6.3
Cython: 0.29.2
numpy: 1.15.4
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 5.8.0
sphinx: 1.8.2
patsy: 0.5.1
dateutil: 2.6.1
pytz: 2018.7
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: 2.2.3
openpyxl: 2.5.12
xlrd: 1.2.0
xlwt: 1.2.0
xlsxwriter: 1.1.2
lxml: 4.2.5
bs4: 4.6.3
html5lib: 1.0.1
sqlalchemy: 1.2.15
pymysql: None
psycopg2: 2.8.1 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: