From bb24ef3f85a93409796efad424ea3f029cfae00a Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 3 May 2022 09:45:03 -0700 Subject: [PATCH] Do not use CREATE OR REPLACE FUNCTION Signed-off-by: Ana Hobden --- pgx-examples/triggers/src/lib.rs | 2 +- pgx-macros/src/lib.rs | 2 +- pgx-tests/src/tests/pg_extern_tests.rs | 2 +- pgx-tests/src/tests/schema_tests.rs | 2 +- pgx-utils/src/sql_entity_graph/pg_extern/entity/mod.rs | 2 +- pgx/src/aggregate.rs | 4 ++-- pgx/src/fcinfo.rs | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pgx-examples/triggers/src/lib.rs b/pgx-examples/triggers/src/lib.rs index 17c5b951e..22cec4fef 100644 --- a/pgx-examples/triggers/src/lib.rs +++ b/pgx-examples/triggers/src/lib.rs @@ -11,7 +11,7 @@ use pgx::*; pg_module_magic!(); /// ```sql -/// CREATE OR REPLACE FUNCTION trigger_example() +/// CREATE FUNCTION trigger_example() /// RETURNS TRIGGER /// LANGUAGE c /// AS 'MODULE_PATHNAME', 'trigger_example_wrapper'; diff --git a/pgx-macros/src/lib.rs b/pgx-macros/src/lib.rs index 65eac25fc..cf8f8c882 100644 --- a/pgx-macros/src/lib.rs +++ b/pgx-macros/src/lib.rs @@ -1038,7 +1038,7 @@ Currently `sql` can be provided one of the following: * Disable SQL generation with `#[pgx(sql = false)]` * Call custom SQL generator function with `#[pgx(sql = path::to_function)]` -* Render a specific fragment of SQL with a string `#[pgx(sql = "CREATE OR REPLACE FUNCTION ...")]` +* Render a specific fragment of SQL with a string `#[pgx(sql = "CREATE FUNCTION ...")]` */ #[proc_macro_attribute] diff --git a/pgx-tests/src/tests/pg_extern_tests.rs b/pgx-tests/src/tests/pg_extern_tests.rs index 615605dbc..420744bc2 100644 --- a/pgx-tests/src/tests/pg_extern_tests.rs +++ b/pgx-tests/src/tests/pg_extern_tests.rs @@ -36,7 +36,7 @@ mod tests { // Ensures `@MODULE_PATHNAME@` and `@FUNCTION_NAME@` are handled. #[pg_extern(sql = r#" - CREATE OR REPLACE FUNCTION tests."overridden_sql_with_fn_name"() RETURNS void + CREATE FUNCTION tests."overridden_sql_with_fn_name"() RETURNS void STRICT LANGUAGE c /* Rust */ AS '@MODULE_PATHNAME@', '@FUNCTION_NAME@'; diff --git a/pgx-tests/src/tests/schema_tests.rs b/pgx-tests/src/tests/schema_tests.rs index 258f6cb0f..880e01f46 100644 --- a/pgx-tests/src/tests/schema_tests.rs +++ b/pgx-tests/src/tests/schema_tests.rs @@ -44,7 +44,7 @@ mod test_schema { ) -> Result> { if let SqlGraphEntity::Function(ref func) = entity { Ok(format!("\ - CREATE OR REPLACE FUNCTION test_schema.\"func_generated_with_custom_name\"() RETURNS void\n\ + CREATE FUNCTION test_schema.\"func_generated_with_custom_name\"() RETURNS void\n\ LANGUAGE c /* Rust */\n\ AS 'MODULE_PATHNAME', '{unaliased_name}_wrapper';\ ", diff --git a/pgx-utils/src/sql_entity_graph/pg_extern/entity/mod.rs b/pgx-utils/src/sql_entity_graph/pg_extern/entity/mod.rs index c2619e772..b21d02b8a 100644 --- a/pgx-utils/src/sql_entity_graph/pg_extern/entity/mod.rs +++ b/pgx-utils/src/sql_entity_graph/pg_extern/entity/mod.rs @@ -108,7 +108,7 @@ impl ToSql for PgExternEntity { let module_pathname = &context.get_module_pathname(); let fn_sql = format!("\ - CREATE OR REPLACE FUNCTION {schema}\"{name}\"({arguments}) {returns}\n\ + CREATE FUNCTION {schema}\"{name}\"({arguments}) {returns}\n\ {extern_attrs}\ {search_path}\ LANGUAGE c /* Rust */\n\ diff --git a/pgx/src/aggregate.rs b/pgx/src/aggregate.rs index e63111b2e..4ef3eca55 100644 --- a/pgx/src/aggregate.rs +++ b/pgx/src/aggregate.rs @@ -202,7 +202,7 @@ Generates: ```sql -- src/lib.rs:11 -- aggregate::demo_sum_state -CREATE OR REPLACE FUNCTION "demo_sum_state"( +CREATE FUNCTION "demo_sum_state"( "this" DemoSum, /* aggregate::DemoSum */ "arg_one" integer /* i32 */ ) RETURNS DemoSum /* aggregate::DemoSum */ @@ -246,7 +246,7 @@ Creates: ```sql -- src/lib.rs:13 -- aggregate::demo_sum_state -CREATE OR REPLACE FUNCTION "demo_sum_state"( +CREATE FUNCTION "demo_sum_state"( "this" DemoSumState, /* aggregate::DemoSumState */ "arg_one" integer /* i32 */ ) RETURNS DemoSumState /* aggregate::DemoSumState */ diff --git a/pgx/src/fcinfo.rs b/pgx/src/fcinfo.rs index 1f693b101..afb3a51bf 100644 --- a/pgx/src/fcinfo.rs +++ b/pgx/src/fcinfo.rs @@ -21,7 +21,7 @@ use crate::{pg_sys, void_mut_ptr, AllocatedByRust, FromDatum, PgBox, PgMemoryCon /// This example will create a SQL function like so: /// /// ```sql -/// CREATE OR REPLACE FUNCTION fun_with_default_arg_value(a integer, b integer DEFAULT 99) RETURNS integer ...; +/// CREATE FUNCTION fun_with_default_arg_value(a integer, b integer DEFAULT 99) RETURNS integer ...; /// ``` /// /// ```rust @@ -61,7 +61,7 @@ pub struct NULL; /// This example will create a SQL function like so: /// /// ```sql -/// CREATE OR REPLACE FUNCTION get_a_set() RETURNS TABLE (id integer, title text) ...; +/// CREATE FUNCTION get_a_set() RETURNS TABLE (id integer, title text) ...; /// ``` /// /// ```rust