TeamSQL / desktop-app

This repository is currently being used for hosting the official issue & bug tracker of TeamSQL Desktop App.
102 stars 6 forks source link

Postgres: Cannot add rows or update cells when columns are camelCase #428

Open rodbv opened 6 years ago

rodbv commented 6 years ago

I'm on version 4.0.307 (4.0.307.307) (Mac OS)

When using the data editor inside TeamSQL to add rows or update a cell value, the command generated by TeamSQL won't work when one of the columns involved in the update/insert operation are camelCase (it needs double quotes around it, otherwise postgres will ignore upper case chars).

Steps to reproduce:

  1. Create a table with a column using camelCase, such as "firstName"
  2. Add a row to the table using the "Add rows" button
  3. Enter a value for firstName and press apply
  4. Generated statement will be as such: insert into "users" (firstName, lastName) values ('John', 'Doe');
  5. Command will fail, as postgres requires double quotes e.g insert into "users" ("firstName", "lastName") values ('John', 'Doe'); (it will return something like "column firstname does not exist")
selcukayhan commented 6 years ago

Hi @rodbv ,

Thank you for reaching us, I can not reproduce your case because my query was completed successfully. I am using latest version which versioned 4.0.379 Firstly, can you please update your TeamSQL App to latest version please.

My queries :

SELECT * FROM "public"."actor22" LIMIT 200;

UPDATE "public"."actor22" SET  firstName = 'selcuk' WHERE actorid = 1;

insert into "public"."actor22" (firstName, lastName) values ('John', 'Doe');

I found another bug about camelCase on there and also we are investigating your issue. If 4.0.379 will not resolve your issue please contact us again.

Thank you.

rodbv commented 6 years ago

Hi @selcukayhan thanks for the reply.

I've updated to 4.0.379 and I still have the issue. Note that, in the queries that you've shown, the camelCase columns also don't have the double quotes around them, which should produce the error. I wonder if your version of Postgres allows camelCase for identifiers?

UPDATE "public"."actor22" SET  firstName = 'selcuk' WHERE actorid = 1;

insert into "public"."actor22" (firstName, lastName) values ('John', 'Doe');

At least on my postgresql version (it's running on AWS RDS, version 9.6.6 on x86_64-pc-linux-gnu) I get this if I run a query like the one you've pasted:

ERROR: column "firstname" of relation "actor22" does not exist
wgrisa commented 6 years ago

Hi guys, I'm facing the same issue as @rodbv. Any luck reproducing and/or fixing it? Many thanks.

dwyfrequency commented 5 years ago

I think this may help. You need to have camel cased column names in quotes "". https://stackoverflow.com/questions/20878932/are-postgresql-column-names-case-sensitive