question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sqlhydra-npgsql generation tool doesn't pick up "enum" columns

See original GitHub issue

Postgres has enumerated datatypes. The sqlhydra-npgsql generation tool doesn’t seem to pick up these type of columns. I’d love it if it could at least think it’s a column of type string.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
JordanMarrcommented, Mar 26, 2022

Ok I see what needs to happen:

        testTask "Insert Enum ADONET" {
            use conn = new Npgsql.NpgsqlConnection(connectionString)
            use cmd = conn.CreateCommand()
            cmd.CommandText <- 
                """
                INSERT INTO experiments.person (name, current_mood)
                VALUES (@name, @mood::mood)
                """
            let pName = cmd.CreateParameter()
            pName.ParameterName <- "@name"
            pName.Value <- "john doe"
            cmd.Parameters.Add pName |> ignore

            let pMood = cmd.CreateParameter()
            pMood.ParameterName <- "@mood"
            pMood.Value <- "happy"
            cmd.Parameters.Add pMood |> ignore

            conn.Open()

            let! results = cmd.ExecuteNonQueryAsync()

            Expect.isTrue (results > 0) ""
        }
0reactions
JordanMarrcommented, Mar 28, 2022

Added a caveat that you may need to watch out for in the release notes. I filed an npgsql issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GetSchema fails when enum is not in `public` · Issue #4392
Steps to reproduce I have noticed that creating a custom enum type and a ... sqlhydra-npgsql generation tool doesn't pick up "enum" columns...
Read more >
JordanMarr/SqlHydra
SqlHydra is a suite of NuGet packages for working with databases in F# including code generation tools and query expressions.
Read more >
Enum Type Mapping
Enum Type Mapping. By default, any enum properties in your model will be mapped to database integers. EF Core 2.1 also allows you...
Read more >
I can't create field of Enum type: sqlalchemy.exc. ...
I found a workaround. It turned out that the problem happens only when a table already exists. So, I created a temp table...
Read more >
Dealing with Enum Type in PostgreSQL
Enum type is useful tool to ensure type safety in PostgreSQL. I personally use it to make sure system flow doesn't mess up....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found