@@ -140,12 +140,12 @@ pub async fn create_partitioned_table<G: GenericClient>(
140140 partition_specs : & [ ( & str , & str ) ] , // (partition_name, partition_constraint)
141141) -> Result < ( TableId , Vec < TableId > ) , tokio_postgres:: Error > {
142142 let create_parent_query = format ! (
143- "CREATE TABLE {} (
143+ "create table {} (
144144 id bigserial,
145145 data text NOT NULL,
146146 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)" ,
149149 table_name. as_quoted_identifier( )
150150 ) ;
151151
@@ -156,8 +156,8 @@ pub async fn create_partitioned_table<G: GenericClient>(
156156 . as_ref ( )
157157 . unwrap ( )
158158 . 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" ,
161161 & [ & table_name. schema , & table_name. name ] ,
162162 )
163163 . await ?;
@@ -172,7 +172,7 @@ pub async fn create_partitioned_table<G: GenericClient>(
172172 ) ;
173173
174174 let create_partition_query = format ! (
175- "CREATE TABLE {} PARTITION OF {} FOR VALUES {}" ,
175+ "create table {} partition of {} for values {}" ,
176176 partition_table_name. as_quoted_identifier( ) ,
177177 table_name. as_quoted_identifier( ) ,
178178 partition_constraint
@@ -185,8 +185,8 @@ pub async fn create_partitioned_table<G: GenericClient>(
185185 . as_ref ( )
186186 . unwrap ( )
187187 . 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" ,
190190 & [ & partition_table_name. schema , & partition_table_name. name ] ,
191191 )
192192 . await ?;
0 commit comments