Open
Conversation
Fyko
commented
Dec 27, 2023
Comment on lines
29
to
60
| #[pg_extern(immutable, parallel_safe, requires = ["shell_type"])] | ||
| fn pksuid_send(input: Pksuid) -> Vec<u8> { | ||
| input.into() | ||
| } | ||
|
|
||
| #[pg_extern(immutable, parallel_safe, requires = ["shell_type"])] | ||
| fn pksuid_receive(internal: pgrx::Internal) -> Pksuid { | ||
| let string_info = unsafe { | ||
| let data = internal.get_mut::<StringInfoData>(); | ||
| StringInfo::from_pg(data.unwrap()) | ||
| } | ||
| .unwrap(); | ||
|
|
||
| Pksuid::from_str(&string_info.to_string()).unwrap() | ||
| } | ||
|
|
||
| extension_sql!("CREATE TYPE pksuid; -- shell type", name = "shell_type", bootstrap); | ||
|
|
||
| extension_sql!( | ||
| r#" | ||
| create type pksuid ( | ||
| input = pksuid_in, | ||
| output = pksuid_out, | ||
| receive = pksuid_receive, | ||
| send = pksuid_send, | ||
| like = text | ||
| ); | ||
| "#, | ||
| name = "concrete_type", | ||
| creates = [Type(Pksuid)], | ||
| requires = ["shell_type", pksuid_in, pksuid_out, pksuid_receive, pksuid_send], | ||
| ); |
Member
Author
There was a problem hiding this comment.
Error:
0: Could not write SQL to /home/carter/.pgrx/16.1/pgrx-install/share/postgresql/extension/pksuid--0.1.0.sql
1: Failed to toposort SQL entities, node with cycle: Function(PgExternEntity { name: "pksuid_receive", unaliased_name: "pksuid_receive", module_path: "pksuid", full_path: "pksuid::pksuid_receive", metadata: FunctionMetadataEntity { arguments: [FunctionMetadataTypeEntity { type_name: "pgrx::datum::internal::Internal", argument_sql: Ok(As("internal")), return_sql: Ok(One(As("internal"))), variadic: false, optional: true }], retval: Some(FunctionMetadataTypeEntity { type_name: "pksuid::Pksuid", argument_sql: Ok(As("pksuid")), return_sql: Ok(One(As("pksuid"))), variadic: false, optional: false }), path: "fn(pgrx::datum::internal::Internal) -> pksuid::Pksuid" }, fn_args: [PgExternArgumentEntity { pattern: "internal", used_ty: UsedTypeEntity { ty_source: "pgrx::Internal", ty_id: TypeId { t: 86260692751852363780994802165506453074 }, full_path: "pgrx::datum::internal::Internal", module_path: "pgrx::datum::internal", composite_type: None, variadic: false, default: None, optional: false, metadata: FunctionMetadataTypeEntity { type_name: "pgrx::datum::internal::Internal", argument_sql: Ok(As("internal")), return_sql: Ok(One(As("internal"))), variadic: false, optional: true } } }], fn_return: Type { ty: UsedTypeEntity { ty_source: "Pksuid", ty_id: TypeId { t: 77583953109485951222227499036296674600 }, full_path: "pksuid::Pksuid", module_path: "pksuid", composite_type: None, variadic: false, default: None, optional: false, metadata: FunctionMetadataTypeEntity { type_name: "pksuid::Pksuid", argument_sql: Ok(As("pksuid")), return_sql: Ok(One(As("pksuid"))), variadic: false, optional: false } } }, schema: None, file: "pksuid-extension/src/lib.rs", line: 35, extern_attrs: [Immutable, ParallelSafe, Requires([Name("shell_type")])], search_path: None, operator: None, to_sql_config: ToSqlConfigEntity { enabled: true, callback: None, content: None } })
Location:
/home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgrx-sql-entity-graph-0.11.2/src/pgrx_sql.rs:422
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0: cargo_pgrx::command::schema::generate_schema with pg_version=16.1 profile=Dev test=false path=/home/carter/.pgrx/16.1/pgrx-install/share/postgresql/extension/pksuid--0.1.0.sql features=["pg16"]
at /home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-pgrx-0.11.2/src/command/schema.rs:176
1: cargo_pgrx::command::install::install_extension with pg_version=16.1 profile=Dev test=false features=["pg16"]
at /home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-pgrx-0.11.2/src/command/install.rs:114
2: cargo_pgrx::command::run::run with pg_version=16.1 profile=Dev
at /home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-pgrx-0.11.2/src/command/run.rs:94
3: cargo_pgrx::command::run::execute
at /home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-pgrx-0.11.2/src/command/run.rs:55
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR creates the send and receive functions for the
pksuidtype so it works with sqlx, which uses the binary protocolRelevant