Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information_schema database 'database()' method parsing error #32317

Open
go-hobby opened this issue Jul 29, 2024 · 0 comments
Open

Information_schema database 'database()' method parsing error #32317

go-hobby opened this issue Jul 29, 2024 · 0 comments

Comments

@go-hobby
Copy link

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

5.5.0

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-Proxy

Expected behavior

SELECT
kcu.CONSTRAINT_NAME AS constraint_name,
kcu.COLUMN_NAME AS column_name,
kcu.REFERENCED_TABLE_NAME AS referenced_table_name,
kcu.REFERENCED_COLUMN_NAME AS referenced_column_name
FROM information_schema.REFERENTIAL_CONSTRAINTS AS rc
JOIN information_schema.KEY_COLUMN_USAGE AS kcu ON
(
kcu.CONSTRAINT_CATALOG = rc.CONSTRAINT_CATALOG OR
(kcu.CONSTRAINT_CATALOG IS NULL AND rc.CONSTRAINT_CATALOG IS NULL)
) AND
kcu.CONSTRAINT_SCHEMA = rc.CONSTRAINT_SCHEMA AND
kcu.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
WHERE rc.CONSTRAINT_SCHEMA = database() AND kcu.TABLE_SCHEMA = database()

Actual behavior

SELECT
kcu.CONSTRAINT_NAME AS constraint_name,
kcu.COLUMN_NAME AS column_name,
kcu.REFERENCED_TABLE_NAME AS referenced_table_name,
kcu.REFERENCED_COLUMN_NAME AS referenced_column_name
FROM information_schema.REFERENTIAL_CONSTRAINTS AS rc
JOIN information_schema.KEY_COLUMN_USAGE AS kcu ON
(
kcu.CONSTRAINT_CATALOG = rc.CONSTRAINT_CATALOG OR
(kcu.CONSTRAINT_CATALOG IS NULL AND rc.CONSTRAINT_CATALOG IS NULL)
) AND
kcu.CONSTRAINT_SCHEMA = rc.CONSTRAINT_SCHEMA AND
kcu.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
WHERE rc.CONSTRAINT_SCHEMA = database()() AND kcu.TABLE_SCHEMA = database()()

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Execute the SQL statement above

Example codes for reproduce this issue (such as a github link).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants