-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Teach
#[pg_cast]
how to pass down arguments useful to `#[pg_e…
…xtern]` The `#[pg_cast]` macro does two things. It creates a regular UDF and it then generates the appropriate `CREATE CAST` sql. Ultimately, the cast is just a function, so we should support all the attibutes that `#[pg_extern]` supports.
- Loading branch information
1 parent
0193fd0
commit 8541b2b
Showing
3 changed files
with
59 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
12 changes: 8 additions & 4 deletions
12
pgrx-tests/tests/compile-fail/invalid_pgcast_options.stderr
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
error: custom attribute panicked | ||
--> tests/compile-fail/invalid_pgcast_options.rs:3:1 | ||
error: Invalid option `invalid_opt` inside `invalid_opt ` | ||
--> tests/compile-fail/invalid_pgcast_options.rs:3:11 | ||
| | ||
3 | #[pg_cast(invalid_opt)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| ^^^^^^^^^^^ | ||
|
||
error: failed parsing pg_extern arguments | ||
--> tests/compile-fail/invalid_pgcast_options.rs:3:11 | ||
| | ||
= help: message: Unrecognized pg_cast option: invalid_opt. | ||
3 | #[pg_cast(invalid_opt)] | ||
| ^^^^^^^^^^^ |