question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use double quotes for whole column name, when querying object attributes

See original GitHub issue

Use case: Right now if I want to query a object attribute in crateDB I have to use

SELECT objectName['attributeName'] FROM table;
--or
SELECT "objectName"['attributeName'] FROM table;

Although from the SQL-Syntax-perspective objectName[‘attributeName’] is the whole column name. And column names in PostgreSQL and other SQL syntaxes can be encapsulated in double quotes. For tools with postgres support, they might be able to read the object attribute columns, from the schema, but querying might not work if they encapsulate this names in double quotes automatically (like Grafana does)

Feature description:

I would like to be able to query object attribute columns like this:

SELECT "objectName['attributeName']" FROM table;

This should increase the compatibility with some tools encapsulating column names in double quotes.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
seutcommented, Sep 3, 2020

Although it’s syntactically not completely correct, as @mfussenegger pointed out, we’ve decided to add support for quoted subscript expression to improve usability and client compatibility. See https://github.com/crate/crate/pull/10485.

Thank you for bringing this up.

0reactions
proddatacommented, Jul 21, 2020

With the fix of quote_ident the problem is solved for Grafana. However Looker adds the double quotes in code and not using the quote_ident function …

SELECT table_schema, table_name, column_name, data_type FROM information_schema.columns
WHERE table_schema IN ('doc') AND table_name IN ('test') ORDER BY table_name
Read more comments on GitHub >

github_iconTop Results From Across the Web

Single Quote, Double Quote, and Backticks in MySQL Queries
Quotes (Single and Double) are used around strings. Backticks are used around table and column identifiers. Double Quotes. Using double quotes here is...
Read more >
Column Name has quotes - Stack Overflow
If I want to select it how do I do this since there's is double quotes in it? For other columns I have...
Read more >
Identifier Requirements - Snowflake Documentation
To use the double quote character inside a quoted identifier, use two quotes. For example: create table "quote""andunquote""" ...
Read more >
How to use single and double quotes in PostgreSQL - Prisma
Double quotes are used to indicate identifiers within the database, which are objects like tables, column names, and roles. In contrast, single quotes...
Read more >
KB30665: How to change the syntax with column names and ...
The second example shows how double quotes are added around the table and column name. Also brackets or other symbols can be used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found