Skip to content

Commit

Permalink
fix issue #1437 (#1440)
Browse files Browse the repository at this point in the history
This fixes issue #1437.

The problem here is that we were blindly converting the entire
`syn::Variant` value to the Postgres enum variant name when in fact all
we want is its `Ident` value.
  • Loading branch information
eeeebbbbrrrr authored Dec 16, 2023
1 parent 0080e3a commit 294dcc8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pgrx-sql-entity-graph/src/postgres_enum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl ToEntityGraphTokens for PostgresEnum {
let (_static_impl_generics, static_ty_generics, static_where_clauses) =
static_generics.split_for_impl();

let variants = self.variants.iter();
let variants = self.variants.iter().map(|variant| variant.ident.clone());
let sql_graph_entity_fn_name =
syn::Ident::new(&format!("__pgrx_internals_enum_{}", name), Span::call_site());

Expand Down
3 changes: 2 additions & 1 deletion pgrx-tests/src/tests/enum_type_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

#[derive(PostgresEnum, PartialEq, Debug)]
#[derive(PostgresEnum, PartialEq, Debug, Default)]
pub enum Foo {
#[default]
One,
Two,
Three,
Expand Down

0 comments on commit 294dcc8

Please sign in to comment.