PostgreSQL autocomplete incorrect for quoted tables

In PostgreSQL, object names will be double quoted for some cases. When we try to use it in CM autocomplete, it adds extra double quotes. Is there a way to disable it?

Don’t quote "Person" in your schema definition.

The quote is needed by Postgresql. If I don’t add the quotes then it’s incorrect.

The CodeMirror schema notation doesn’t support quotes there, so adding them simply doesn’t mean anything.

That being said, it seems that we should auto-quote names with upper-case characters. This patch adds that.

hi @marijn,
There is a different meaning of quotes in PostgreSQL and it’s not just for upper case.
I think it would be best if we can support quotes.

Hi @marijn,
The commit doesn’t fixes anything for PostgreSQL side. In fact, quoting should be best left to PostgreSQL as it is a very complex decision whether to quote or not.
Allow quoting in autocomplete is the only solution.

Hi @marijn,
I tested with lang-sql@6.5.5, and the autocomplete still doesn’t work for quoted tables.
Firstly, it adds extra quotes even if the table is quoted. Secondly, columns are not showing up for quoted table alias name.

I told you, do not quote the table name in your schema definition for CodeMirror. That doesn’t work.

I understood what you said. But that’s part of PostgreSQL, I cannot decide what to quote and what not. PostgreSQL decides. In fact, if we don’t quote then query won’t run and we’ll need to manually add those quotes. Auto-Quoting based on upper case chars is not enough.

Let me share an example with you. Below is a valid table name, but requires quotes:

No, you’re not understanding what I said. I know how Postgres works. What I am telling you is to not quote the names when defining the schemaCompletions, because that format doesn’t use quotes.

Oh my bad! I didn’t realise it works. I tested it now. :zipper_mouth_face:
I am extremely sorry for wasting your time on this. I should have tested it first. Thank you!