Re: npgsql and postgres enum type

From: "Francisco Figueiredo Jr(dot)" <francisco(at)npgsql(dot)org>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: danclemson <danclemson(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: npgsql and postgres enum type
Date: 2009-11-06 19:12:15
Message-ID: 438d02260911061112q27d5d4el3479c9f6e7a0ffb3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 15, 2009 at 19:01, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Thu, Oct 15, 2009 at 4:14 PM, danclemson <danclemson(at)gmail(dot)com> wrote:
>>
>> Thanks for the information.
>>
>> I did try the approach, but it failed due to any other issue with npgsql.
>>
>> The stored procedure returns a setof refcursor.
>> If I use "select * from test('e1':testEnum)", the command.ExecuteReader does
>> not return the datareader properly. The code errored out when I use the
>> datareader to get the data in the refcursor.
>>
>
> if you can't figure out any other solution (there probably is one),
> wrap your procedure in sql function that takes text and do the casting
> there.
>

I just saw this thread now...

If you want to use enum with Npgsql, you just set the type of your
parameter to DbType.Object and Npgsql won't provide any cast.

This way your query will be sent only with quotes which will allow
postgresql to do the proper handling.

I hope it helps.

--
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior
Sent from Brasilia, DF, Brazil

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2009-11-06 21:17:32 Re: warm standby resume and take online problems
Previous Message Tom Lane 2009-11-06 17:26:52 Re: Search system catalog for mystery type