@@ -15,7 +15,7 @@ pub(crate) fn pg_analyze_and_rewrite(
1515 query_string : * const c_char ,
1616 query_env : * mut QueryEnvironment ,
1717) -> * mut List {
18- #[ cfg( feature = "pg14" ) ]
18+ #[ cfg( pre_pg15 ) ]
1919 unsafe {
2020 pgrx:: pg_sys:: pg_analyze_and_rewrite (
2121 raw_stmt,
@@ -26,7 +26,7 @@ pub(crate) fn pg_analyze_and_rewrite(
2626 )
2727 }
2828
29- #[ cfg( any ( feature = "pg15" , feature = "pg16" , feature = "pg17" ) ) ]
29+ #[ cfg( not ( pre_pg15 ) ) ]
3030 unsafe {
3131 pgrx:: pg_sys:: pg_analyze_and_rewrite_fixedparams (
3232 raw_stmt,
@@ -40,7 +40,7 @@ pub(crate) fn pg_analyze_and_rewrite(
4040
4141#[ allow( non_snake_case) ]
4242pub ( crate ) fn strVal ( val : * mut Node ) -> String {
43- #[ cfg( feature = "pg14" ) ]
43+ #[ cfg( pre_pg15 ) ]
4444 unsafe {
4545 let val = ( * ( val as * mut pgrx:: pg_sys:: Value ) ) . val . str_ ;
4646
@@ -50,7 +50,7 @@ pub(crate) fn strVal(val: *mut Node) -> String {
5050 . to_string ( )
5151 }
5252
53- #[ cfg( any ( feature = "pg15" , feature = "pg16" , feature = "pg17" ) ) ]
53+ #[ cfg( not ( pre_pg15 ) ) ]
5454 unsafe {
5555 let val = ( * ( val as * mut pgrx:: pg_sys:: String ) ) . sval ;
5656
@@ -63,20 +63,20 @@ pub(crate) fn strVal(val: *mut Node) -> String {
6363
6464#[ allow( non_snake_case) ]
6565pub ( crate ) fn MarkGUCPrefixReserved ( guc_prefix : & str ) {
66- #[ cfg( feature = "pg14" ) ]
66+ #[ cfg( pre_pg15 ) ]
6767 unsafe {
6868 pgrx:: pg_sys:: EmitWarningsOnPlaceholders ( guc_prefix. as_pg_cstr ( ) )
6969 }
7070
71- #[ cfg( any ( feature = "pg15" , feature = "pg16" , feature = "pg17" ) ) ]
71+ #[ cfg( not ( pre_pg15 ) ) ]
7272 unsafe {
7373 pgrx:: pg_sys:: MarkGUCPrefixReserved ( guc_prefix. as_pg_cstr ( ) )
7474 }
7575}
7676
7777/// check_copy_table_permission checks if the user has permission to copy from/to the table.
7878/// This is taken from the original PostgreSQL DoCopy function.
79- #[ cfg( any ( feature = "pg16" , feature = "pg17" ) ) ]
79+ #[ cfg( not ( pre_pg16 ) ) ]
8080pub ( crate ) fn check_copy_table_permission (
8181 p_stmt : & PgBox < PlannedStmt > ,
8282 p_state : & PgBox < ParseState > ,
@@ -134,28 +134,7 @@ pub(crate) fn check_copy_table_permission(
134134 unsafe { reset_pgaudit ( guc_level) } ;
135135}
136136
137- unsafe fn disable_pgaudit ( ) -> i32 {
138- let guc_level = NewGUCNestLevel ( ) ;
139-
140- set_config_option (
141- "pgaudit.log" . as_pg_cstr ( ) ,
142- "none" . as_pg_cstr ( ) ,
143- PGC_SUSET ,
144- PGC_S_SESSION ,
145- GUC_ACTION_SAVE ,
146- true ,
147- 0 ,
148- false ,
149- ) ;
150-
151- guc_level
152- }
153-
154- unsafe fn reset_pgaudit ( guc_level : i32 ) {
155- AtEOXact_GUC ( true , guc_level) ;
156- }
157-
158- #[ cfg( any( feature = "pg14" , feature = "pg15" ) ) ]
137+ #[ cfg( pre_pg16) ]
159138pub ( crate ) fn check_copy_table_permission (
160139 p_stmt : & PgBox < PlannedStmt > ,
161140 p_state : & PgBox < ParseState > ,
@@ -198,3 +177,24 @@ pub(crate) fn check_copy_table_permission(
198177
199178 unsafe { reset_pgaudit ( guc_level) } ;
200179}
180+
181+ unsafe fn disable_pgaudit ( ) -> i32 {
182+ let guc_level = NewGUCNestLevel ( ) ;
183+
184+ set_config_option (
185+ "pgaudit.log" . as_pg_cstr ( ) ,
186+ "none" . as_pg_cstr ( ) ,
187+ PGC_SUSET ,
188+ PGC_S_SESSION ,
189+ GUC_ACTION_SAVE ,
190+ true ,
191+ 0 ,
192+ false ,
193+ ) ;
194+
195+ guc_level
196+ }
197+
198+ unsafe fn reset_pgaudit ( guc_level : i32 ) {
199+ AtEOXact_GUC ( true , guc_level) ;
200+ }
0 commit comments