Grafana 6.4.3 + Crate 4.0.7: Cannot use relation "t" in this context.
See original GitHub issueCrateDB version: 4.0.7
Environment description:
- JVM version: java -version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
- Kernel: uname -a
Linux de1.l7dev.co.cc 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Distribution: cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
- Number of nodes; 1 dev node
Problem description:
I am following your blog post to get Grafana 6.4.3 use Crate.io as Data Backend (in Postgre ). When I proceed to Add Query Grafana send SQL as below:
SELECTquote_ident(table_name) as table_name,
( SELECT
quote_ident(column_name) as column_name
FROM information_schema.columns c
WHERE
c.table_schema = t.table_schema AND
c.table_name = t.table_name AND
udt_name IN ('timestamptz','timestamp')
ORDER BY ordinal_position LIMIT 1
) AS time_column,
( SELECT
quote_ident(column_name) AS column_name
FROM information_schema.columns c
WHERE
c.table_schema = t.table_schema AND
c.table_name = t.table_name AND
udt_name='float8'
ORDER BY ordinal_position LIMIT 1
) AS value_column
FROM information_schema.tables t
WHERE
table_schema IN (
SELECT
CASE WHEN trim(s[i]) = '"$user"' THEN user ELSE trim(s[i]) END
FROM
generate_series(
array_lower(string_to_array(current_setting('search_path'),','),1),
array_upper(string_to_array(current_setting('search_path'),','),1)
) as i,
string_to_array(current_setting('search_path'),',') s
) AND
EXISTS
( SELECT 1
FROM information_schema.columns c
WHERE
c.table_schema = t.table_schema AND
c.table_name = t.table_name AND
udt_name IN ('timestamptz','timestamp')
) AND
EXISTS
( SELECT 1
FROM information_schema.columns c
WHERE
c.table_schema = t.table_schema AND
c.table_name = t.table_name AND
udt_name='float8'
)
LIMIT 1
which results in Crate.io throwing an error:
ERROR. Cannot use relation "t" in this context. It is only accessible in the parent context..C0A000.FFullQualifiedNameFieldProvider.java.L141.RraiseUnsupportedFeatureIfInParentScope
Steps to reproduce:
Follow steps in this blog post using Grafana 6.4.3 and Crate 4.0.7
Regards, Chris
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Download Grafana | Grafana Labs
Overview of how to download and install different versions of Grafana on different operating systems.
Read more >Download Grafana | Grafana Labs
Overview of how to download and install different versions of Grafana on different operating systems.
Read more >Configure Grafana | Grafana documentation
Grafana has default and custom configuration files. You can customize your Grafana instance by modifying the custom configuration file or by using environment ......
Read more >Download Grafana | Grafana Labs
Overview of how to download and install different versions of Grafana on ... can be used for free and can be upgraded to...
Read more >Data sources | Grafana documentation
You can also query data sources without building a dashboard by using the Explore ... You can't change an existing query to use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Correlated subquery & EXISTS support was merged and the query works now:
(The TypeORM query still misses other functionality, but the correlated join use would work)
Another sample query produced by TypeORM with correlated sub-query:
Error message:
QueryFailedError: missing FROM-clause entry for relation '[doc.columns]'
I supect issue is that inner SELECT is not aware of parent context and tries to query
doc.columns
table which doesn’t exist.