@@ -140,12 +140,12 @@ pub async fn create_partitioned_table<G: GenericClient>(
140
140
partition_specs : & [ ( & str , & str ) ] , // (partition_name, partition_constraint)
141
141
) -> Result < ( TableId , Vec < TableId > ) , tokio_postgres:: Error > {
142
142
let create_parent_query = format ! (
143
- "CREATE TABLE {} (
143
+ "create table {} (
144
144
id bigserial,
145
145
data text NOT NULL,
146
146
partition_key integer NOT NULL,
147
- PRIMARY KEY (id, partition_key)
148
- ) PARTITION BY RANGE (partition_key)" ,
147
+ primary key (id, partition_key)
148
+ ) partition by range (partition_key)" ,
149
149
table_name. as_quoted_identifier( )
150
150
) ;
151
151
@@ -156,8 +156,8 @@ pub async fn create_partitioned_table<G: GenericClient>(
156
156
. as_ref ( )
157
157
. unwrap ( )
158
158
. query_one (
159
- "SELECT c.oid FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace
160
- WHERE n.nspname = $1 AND c.relname = $2" ,
159
+ "select c.oid from pg_class c join pg_namespace n on n.oid = c.relnamespace
160
+ where n.nspname = $1 and c.relname = $2" ,
161
161
& [ & table_name. schema , & table_name. name ] ,
162
162
)
163
163
. await ?;
@@ -172,7 +172,7 @@ pub async fn create_partitioned_table<G: GenericClient>(
172
172
) ;
173
173
174
174
let create_partition_query = format ! (
175
- "CREATE TABLE {} PARTITION OF {} FOR VALUES {}" ,
175
+ "create table {} partition of {} for values {}" ,
176
176
partition_table_name. as_quoted_identifier( ) ,
177
177
table_name. as_quoted_identifier( ) ,
178
178
partition_constraint
@@ -185,8 +185,8 @@ pub async fn create_partitioned_table<G: GenericClient>(
185
185
. as_ref ( )
186
186
. unwrap ( )
187
187
. query_one (
188
- "SELECT c.oid FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace
189
- WHERE n.nspname = $1 AND c.relname = $2" ,
188
+ "select c.oid from pg_class c join pg_namespace n on n.oid = c.relnamespace
189
+ where n.nspname = $1 and c.relname = $2" ,
190
190
& [ & partition_table_name. schema , & partition_table_name. name ] ,
191
191
)
192
192
. await ?;
0 commit comments