mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
sql parser improved pg support, fix #4128
This commit is contained in:
@@ -52,6 +52,18 @@ public class PostgresqlResourceTest extends PGTest {
|
||||
exec_test("bvt/parser/postgresql-3.txt");
|
||||
}
|
||||
|
||||
public void test_4() throws Exception {
|
||||
exec_test("bvt/parser/postgresql-4.txt");
|
||||
}
|
||||
|
||||
public void test_5() throws Exception {
|
||||
exec_test("bvt/parser/postgresql-5.txt");
|
||||
}
|
||||
|
||||
public void test_6() throws Exception {
|
||||
exec_test("bvt/parser/postgresql-6.txt");
|
||||
}
|
||||
|
||||
public void exec_test(String resource) throws Exception {
|
||||
System.out.println(resource);
|
||||
InputStream is = null;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE tb_a ADD COLUMNS ( a bigint );
|
||||
---------------------------
|
||||
ALTER TABLE tb_a
|
||||
ADD COLUMNS (a bigint);
|
||||
@@ -0,0 +1,4 @@
|
||||
INSERT INTO tb_a VALUES ( 1 );
|
||||
---------------------------
|
||||
INSERT INTO TABLE tb_a
|
||||
VALUES (1);
|
||||
@@ -0,0 +1,20 @@
|
||||
SET data = jsonb_set(
|
||||
data,
|
||||
ARRAY[(
|
||||
SELECT idx - 1 AS idx
|
||||
FROM cgm_data c1,
|
||||
jsonb_array_elements(data)
|
||||
WHERE
|
||||
info ->> 'index' = ?
|
||||
and c1.id = ?
|
||||
)]::TEXT[],
|
||||
?::jsonb
|
||||
)
|
||||
WHERE t1.id = ?;
|
||||
---------------------------
|
||||
SET data TO jsonb_set(data, ARRAY[(
|
||||
SELECT idx - 1 AS idx
|
||||
FROM cgm_data c1, jsonb_array_elements(data)
|
||||
WHERE info ->> 'index' = ?
|
||||
AND c1.id = ?
|
||||
)]::TEXT[], ?::jsonb), t1, id, id
|
||||
@@ -0,0 +1,5 @@
|
||||
select * from com_demo order by sex asc nulls first
|
||||
---------------------------
|
||||
SELECT *
|
||||
FROM com_demo
|
||||
ORDER BY sex ASC NULLS FIRST
|
||||
@@ -0,0 +1,5 @@
|
||||
alter table if exists tcweatherdata
|
||||
add column predictiontime timestamp
|
||||
---------------------------
|
||||
ALTER TABLE IF EXISTS tcweatherdata
|
||||
ADD COLUMN predictiontime timestamp
|
||||
Reference in New Issue
Block a user