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

Support data type jsonb for PostgreSQL #628

Closed
sagkanon opened this issue Mar 5, 2018 · 6 comments
Closed

Support data type jsonb for PostgreSQL #628

sagkanon opened this issue Mar 5, 2018 · 6 comments

Comments

@sagkanon
Copy link

sagkanon commented Mar 5, 2018

Please answer these questions before submitting your issue. Thanks!
开源不易,我们希望将精力放在完成新功能和解决有价值的问题上,为了让大家的配合更具有效率,请填写以下列出的全部问题

请问sharding-jdbc的sql parser是否支持postgresql的数据类型geography(Point,4326)以及jsonb ?
官方文档http://shardingjdbc.io/docs_cn/01-start/sql-supported/并没有明确说明

但是实际执行下来对于这个sql的DMLStatement如下,user_new_id的positonIndex并不对
update t_order
set start_time=?,
status=0,
start_point=ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')'),
rule=?::jsonb,
discount_type=?,
order_type=?
where
user_new_id = ?
AND create_time=?
AND guid=?

DMLStatement(super=AbstractSQLStatement(type=DML, tables=Tables(tables=[Table(name=t_order, alias=Optional.absent())]), conditions=Conditions(conditions={Column(name=user_new_id, tableName=t_order)=Condition(column=Column(name=user_new_id, tableName=t_order), operator=EQUAL, positionValueMap={}, positionIndexMap={0=4}), Column(name=create_time, tableName=t_order)=Condition(column=Column(name=create_time, tableName=t_order), operator=EQUAL, positionValueMap={}, positionIndexMap={0=5}), Column(name=guid, tableName=t_order)=Condition(column=Column(name=guid, tableName=t_order), operator=EQUAL, positionValueMap={}, positionIndexMap={0=6})}), sqlTokens=[TableToken(beginPosition=7, originalLiterals=t_order)], parametersIndex=7))

Which version of Sharding-Jdbc do you using?(您使用的Sharding-Jdbc版本为?)

2.0.2

Expected behavior (您预期的结果是)

Actual behavior (实际运行的结果是)

Steps to reproduce the behavior (可重现问题的操作步骤)

Please provide the reproduce example codes (such as github link),otherwise we will label the issue as Invalid and close it.(为了节省复现问题的时间,请务必提供可重现的代码,否则我们会将issue直接标记为invalid并关闭)

Code should based on https://github.com/shardingjdbc/sharding-jdbc-example
(代码请基于 https://github.com/shardingjdbc/sharding-jdbc-example)

@terrymanu
Copy link
Member

terrymanu commented Mar 5, 2018

We do not test for geography and jsonb data type.
If use them for sharding columns, sharding-jdbc cannot support; If use them for non-sharding columns, maybe fine.
If you interested, cloud you just test them? Thank you.

@sagkanon
Copy link
Author

sagkanon commented Mar 5, 2018

测试下来是有问题的 上面贴出来的解析出来的DMLStatement可以看出来 看上去值的对应关系是错误的
在进行db的路由时 使用了standard strategy 只根据上面sql中user_new_id来进行路由的
在进行table的路由时 使用了complex strategy 根据user_new_id, guid, create_time来进行路由的

我测下来 在进行db路由时 user_new_id取到的值是其他column的值

@terrymanu
Copy link
Member

We don't consider about some special data types indeed.
We can enhance some one in future. If you interested on this, welome give us a pull request.

@sagkanon
Copy link
Author

sagkanon commented Mar 6, 2018

thanks! it is urgent for me, so I would like to support the data types by myself first.

@sagkanon
Copy link
Author

sagkanon commented Mar 6, 2018

after verification work, then I will register a pull request.

@terrymanu
Copy link
Member

fixed at 3.0.0.M1

@terrymanu terrymanu changed the title sharding-jdbc是否支持postgresql的数据类型geography(Point,4326)以及jsonb Support data type jsonb for PostgreSQL Aug 8, 2018
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

3 participants