Does npgsql have a bunch of bugs with DB enums?

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Does npgsql have a bunch of bugs with DB enums?
Date: 2010-06-07 11:43:42
Message-ID: AANLkTim-nnwpsS62dFmGXk0SmGHdTTmgrKK9ge_MH0Jz@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This is probably not the right forum for this question, but maybe
someone can help me out or redirect me.

I'm running into a lot of problems with npgsql and enum types. There
seems to be very little support or testing in this area. The issue
right now is I have a lot of SQL functions that have OUT parameters of
an enum type. Such as:

CREATE TYPE UnitTypeEnum AS ENUM ('Unit', 'Volume', 'Weight');

CREATE OR REPLACE FUNCTION readformsforingredient(IN _ingredient text,
OUT UnitType UnitTypeEnum)
RETURNS SETOF record AS
...

When I call that function using the npgsql driver, I get all sorts of
errors. The data table simple has no ProviderType (it's blank), even
though the DataType is System.String. If I try to read the data
reader, I get exceptions. The solution I found is to cast the enum to
a text, such as:

CREATE OR REPLACE FUNCTION readformsforingredient(IN _ingredient text,
OUT UnitType text)
...
select UnitType::text from foo;

However, this becomes a pain if I'm not using OUT parameters and just
returning a set of a row type. Plus, having to cast ENUMs is kind of
a hack.

Are the people working on npgsql aware of this problem, and can we
expect to get real enum support in future versions? It seems they
should just magically cast to either a string or an int and I
shouldn't have to worry about that. Thanks!!

Mike

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2010-06-07 11:58:36 Re: Error in 8.4.4-1 of windows installer from Enterprisedb
Previous Message Kenichiro Tanaka 2010-06-07 10:44:28 Re: WINDOWS : PostgreSQL 8.4 Server Start Error