-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
The result of comparison function on date value should return DATE type #46475
Labels
affects-5.3
This bug affects 5.3.x versions.
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
component/expression
found/gs
found by gs
report/customer
Customers have encountered this bug.
severity/major
sig/execution
SIG execution
type/bug
The issue is confirmed as a bug.
type/compatibility
Comments
This causes issues with MySQL Connector/J 8.x package com.pingcap.tidb_demo_java;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
public class App
{
public static void main( String[] args )
{
try {
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
} catch (Exception ex) {
System.out.println("Failed to load driver: " + ex.getMessage());
}
try {
Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:4000?user=root");
// This works
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT CURRENT_DATE()");
rs.next();
System.out.println("CURRENT_DATE() result: " + rs.getString("CURRENT_DATE()"));
// This results in SQLException: Invalid length (10) for type TIMESTAMP
// Tested on TiDB v7.3.0
Statement stmt2 = conn.createStatement();
ResultSet rs2 = stmt.executeQuery("SELECT COALESCE(CURRENT_DATE(),NULL) a");
rs2.next();
System.out.println("CURRENT_TIMESTAMP() result: " + rs2.getString("a"));
} catch (SQLException ex) {
System.out.println("SQLException: " + ex.getMessage());
}
}
} Output:
|
ti-chi-bot
bot
added
may-affects-5.3
This bug maybe affects 5.3.x versions.
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
may-affects-6.5
may-affects-7.1
labels
Aug 29, 2023
dveeden
added
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-5.3
This bug affects 5.3.x versions.
component/expression
and removed
may-affects-7.1
may-affects-6.5
may-affects-6.1
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-5.3
This bug maybe affects 5.3.x versions.
labels
Aug 29, 2023
/found gs |
/report customer |
This was referenced Sep 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects-5.3
This bug affects 5.3.x versions.
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
component/expression
found/gs
found by gs
report/customer
Customers have encountered this bug.
severity/major
sig/execution
SIG execution
type/bug
The issue is confirmed as a bug.
type/compatibility
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
v6.6.0
The text was updated successfully, but these errors were encountered: