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

[Bug] [kingbase] ERROR: syntax error at or near "t1" #1920

Closed
3 tasks done
libailin opened this issue Sep 5, 2024 · 0 comments · Fixed by #1923
Closed
3 tasks done

[Bug] [kingbase] ERROR: syntax error at or near "t1" #1920

libailin opened this issue Sep 5, 2024 · 0 comments · Fixed by #1923
Labels
bug Something isn't working

Comments

@libailin
Copy link
Contributor

libailin commented Sep 5, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

KingbaseES V008R006C008B0020 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28), 64-bit 该版本执行插入带表别名的sql时报错。

Caused by: com.kingbase8.util.KSQLException: ERROR: syntax error at or near "t1";
  Position: 48
	at com.kingbase8.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2575)
	at com.kingbase8.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2311)
	at com.kingbase8.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:319)
	at com.kingbase8.jdbc.KbStatement.executeInternal(KbStatement.java:472)
	at com.kingbase8.jdbc.KbStatement.execute(KbStatement.java:392)
	at com.kingbase8.jdbc.KbPreparedStatement.executeWithFlags(KbPreparedStatement.java:178)
	at com.kingbase8.jdbc.KbPreparedStatement.execute(KbPreparedStatement.java:167)
	at com.dtstack.chunjun.connector.jdbc.statement.FieldNamedPreparedStatementImpl.execute(FieldNamedPreparedStatementImpl.java:173)
	at com.dtstack.chunjun.connector.jdbc.sink.wrapper.SimpleStatementWrapper.writeSingleRecord(SimpleStatementWrapper.java:54)
	at com.dtstack.chunjun.connector.jdbc.sink.wrapper.SimpleStatementWrapper.writeSingleRecord(SimpleStatementWrapper.java:29)
	at com.dtstack.chunjun.connector.jdbc.sink.JdbcOutputFormat.writeSingleRecordInternal(JdbcOutputFormat.java:217)

看源码是生成插入sql时会定义一个 t1的别名

INSERT INTO "middle_dev"."dc_table_constraint" t1 ("id", "only_code", "created_time") VALUES (361, '2023-03-22_tableUseTimeTask', '2023-03-23 10:30:14+08');

47289ce4c495c04b410717ce16857c8

What you expected to happen

--

How to reproduce


CREATE TABLE source
(
  `id` int,
  `only_code` string,
  `created_time` timestamp(0)
) WITH (
      'password' = 'xxx',
      'connector' = 'mysql-x',
      'scan.partition.column' = '',
      'scan.parallelism' = '1',
      'scan.where' = '',
      'scan.query-timeout' = '600',
      'table-name' = 'dc_table_constraint',
      'url' = 'jdbc:mysql://xxx:20851/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=3000&useunicode=true&characterEncoding=utf8&useSSL=false&useCursorFetch=true&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull',
      'username' = 'xxxx'
      );
CREATE TABLE sink
(
  `id` int,
  `only_code` string,
  `created_time` timestamp(0)
) WITH (
      'schema' = 'middle_dev',
      'password' = 'xxx',
      'connector' = 'kingbase-x',
      'sink.buffer-flush.interval' = '1000',
      'sink.buffer-flush.max-rows' = '1024',
      'sink.all-replace' = 'false',
      'table-name' = 'dc_table_constraint',
      'url' = 'jdbc:kingbase8://xxxx:4321/middle_dev',
      'username' = 'xxxx'
      );
insert into sink 
select 
`id` as `id`,
`only_code` as `only_code`,
`created_time` as `created_time`
 from source ;

Anything else

No response

Version

master

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@libailin libailin added the bug Something isn't working label Sep 5, 2024
@libailin libailin changed the title [Bug] [kingbase] [Bug] [kingbase] ERROR: syntax error at or near "t1" Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant