Re: [GENERAL] Recovering from failed transaction

2014-03-11 Thread Francisco Figueiredo Jr.
Hi Brian!

I got a patch to fix this. Unfortunately, I'm having some problems with
github at this moment and I couldn't push it to create a pull request.

 Would you mind to patch a local copy of Npgsql code and give it a try?

Here is the patch:


diff --git a/Npgsql/Npgsql/NpgsqlConnector.cs
b/Npgsql/Npgsql/NpgsqlConnector.cs
index eb7da15..5e090be 100644
--- a/Npgsql/Npgsql/NpgsqlConnector.cs
+++ b/Npgsql/Npgsql/NpgsqlConnector.cs
@@ -427,7 +427,7 @@ internal void ReleaseResources()

 internal void ReleaseWithDiscard()
 {
-NpgsqlCommand.ExecuteBlind(this, NpgsqlQuery.DiscardAll, 60);
+NpgsqlCommand.ExecuteBlind(this, NpgsqlQuery.DiscardAll);

 // The initial connection parameters will be restored via
IsValid()
 }
@@ -828,7 +828,7 @@ internal void Open()

 initQueries = sbInitQueries.ToString();

-NpgsqlCommand.ExecuteBlind(this, initQueries, 60);
+NpgsqlCommand.ExecuteBlind(this, initQueries);

 // Make a shallow copy of the type mapping that the connector
will
 // It is possible that the connector may add types to its
privateY



Thanks in advance and sorry for this problem.



On Mon, Mar 10, 2014 at 6:49 PM, Brian Crowell br...@fluggo.com wrote:

 On Mon, Mar 10, 2014 at 4:16 PM, Jeff Janes jeff.ja...@gmail.com wrote:
  ...  Or maybe it is mangling the ROLLBACK; into some form
  the database doesn't recognize.  Look in the postgres log files to see
 what
  the events look like from PostgreSQL's perspective.

 Well that's the clue I needed. I was misinterpreting Postgres's log
 file; it was complaining about the SET statement_timeout statement
 Npgsql was slipping ahead of my ROLLBACK. Apparently I need to do
 transactions with Npgsql's transaction class.

 --Brian


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior


Re: [GENERAL] Npgsql - Where can I find Npgsql.NpgsqlServices

2013-12-12 Thread Francisco Figueiredo Jr.
Hi, Mike.

We are working to get EF6 properly supported and our master branch already
has support for it.
Unfortunately pgfoundry is down at the moment.

Please, if you can compile Npgsql from source code, please get a current
snapshot from github and give it a try: https://github.com/npgsql/Npgsql and
directly https://github.com/npgsql/Npgsql/archive/master.zip
Just open the project on visual studio and select the correct configuration
(net-45) and you will get Npgsql.dll and Npgsql.EntityFramework.dll in the
EntityFramework/bin folder.

I hope it helps.

Let me know if you have any question.



On Thu, Dec 12, 2013 at 1:24 AM, Mike Christensen m...@kitchenpc.comwrote:

 It seems I need NpgsqlServices to use Npgsql with EF6, however I can't
 figure out where you get this thing!

 I've tried installing it through NuGet:

 PM Install-Package Npgsql -pre
 Installing 'Npgsql 2.0.14.1'.
 Successfully installed 'Npgsql 2.0.14.1'.
 Adding 'Npgsql 2.0.14.1' to EFTest.
 Successfully added 'Npgsql 2.0.14.1' to EFTest.


 However, this doesn't have it.  I've also tried installing the beta from:


 http://pgfoundry.org/frs/download.php/3494/Npgsql2.0.13.91-bin-ms.net4.5Ef6.zip

 No luck there.  Any ideas?

 Mike




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior


Re: [GENERAL] Npgsql - Where can I find Npgsql.NpgsqlServices

2013-12-12 Thread Francisco Figueiredo Jr.
On Thu, Dec 12, 2013 at 2:55 PM, Mike Christensen m...@kitchenpc.comwrote:

 Thanks!  Got it working after messing around for a while..


Great! I'm glad to hear it.


 I decided to check out EF for a new project I'm working on.  So far, I
 think I like NHibernate better.  A lot more control, and works flawlessly
 with Postgres and Npgsql.


:)

EF support in Npgsql is very new and we are lacking a lot of features. We
hope to improve this support in the next versions.

Please, let us know if you have any other question or need any assistance.



 Mike




 On Thu, Dec 12, 2013 at 8:34 AM, Francisco Figueiredo Jr. 
 franci...@npgsql.org wrote:


 Hi, Mike.

 We are working to get EF6 properly supported and our master branch
 already has support for it.
 Unfortunately pgfoundry is down at the moment.

 Please, if you can compile Npgsql from source code, please get a current
 snapshot from github and give it a try: https://github.com/npgsql/Npgsql and
 directly https://github.com/npgsql/Npgsql/archive/master.zip
 Just open the project on visual studio and select the correct
 configuration (net-45) and you will get Npgsql.dll and
 Npgsql.EntityFramework.dll in the EntityFramework/bin folder.

 I hope it helps.

 Let me know if you have any question.



 On Thu, Dec 12, 2013 at 1:24 AM, Mike Christensen m...@kitchenpc.comwrote:

 It seems I need NpgsqlServices to use Npgsql with EF6, however I can't
 figure out where you get this thing!

 I've tried installing it through NuGet:

 PM Install-Package Npgsql -pre
 Installing 'Npgsql 2.0.14.1'.
 Successfully installed 'Npgsql 2.0.14.1'.
 Adding 'Npgsql 2.0.14.1' to EFTest.
 Successfully added 'Npgsql 2.0.14.1' to EFTest.


 However, this doesn't have it.  I've also tried installing the beta from:


 http://pgfoundry.org/frs/download.php/3494/Npgsql2.0.13.91-bin-ms.net4.5Ef6.zip

 No luck there.  Any ideas?

 Mike




 --
 Regards,

 Francisco Figueiredo Jr.
 Npgsql Lead Developer
 http://www.npgsql.org
 http://gplus.to/franciscojunior
 http://fxjr.blogspot.com
 http://twitter.com/franciscojunior





-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior


Re: [GENERAL] NpgsqlCopySerializer blows up if no rows are saved

2013-12-02 Thread Francisco Figueiredo Jr.
Hi!

You should post Npgsql questions to our user's forums :
http://forums.npgsql.org

In this case I think it is a bug in Npgsql. Please add this test program to
your post when talking about this problem.

Thanks in advance.
 Em 02/12/2013 19:29, AK alk...@gmail.com escreveu:

 I am not sure if this is the correct place to post my question to. If this
 is
 a wrong list, can you tell me the right one.

 I am bulk loading rows using the following code:

 const string connString =
 myConnString;
 using(var conn = new NpgsqlConnection(connString))
 {
 conn.Open();
 var command = conn.CreateCommand();
 var copyStr = string.Format(COPY staging.test(col1,col2) FROM STDIN);
 command.CommandText = copyStr;
 command.CommandType = CommandType.Text;
 var serializer = new NpgsqlCopySerializer(conn);
 var copyIn = new NpgsqlCopyIn(command, conn, serializer.ToStream);
 copyIn.Start();
 foreach (var row in incomingRows)
 {
 //feed the values here
 }
 copyIn.End();
 serializer.Flush();
 serializer.Close();
 command.Dispose();
 }
 If incomingRows has one or more items, this works. However, if no rows are
 saved, serializer.Close() blows up:

 System.NullReferenceException : Object reference not set to an instance of
 an object.
 at Npgsql.NpgsqlCopySerializer.Close()

 What am I doing wrong?





 --
 View this message in context:
 http://postgresql.1045698.n5.nabble.com/NpgsqlCopySerializer-blows-up-if-no-rows-are-saved-tp5781300.html
 Sent from the PostgreSQL - general mailing list archive at Nabble.com.


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general



Re: [GENERAL] NpgsqlCopySerializer blows up if no rows are saved

2013-12-02 Thread Francisco Figueiredo Jr.
Whooops. Sorry for not replying. :-(

I'll check the problem and reply you back.
 Em 02/12/2013 20:21, AK alk...@gmail.com escreveu:

 I did a week ago -  and got no replies at all. Thank you.



 --
 View this message in context:
 http://postgresql.1045698.n5.nabble.com/NpgsqlCopySerializer-blows-up-if-no-rows-are-saved-tp5781300p5781316.html
 Sent from the PostgreSQL - general mailing list archive at Nabble.com.


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general



Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-12 Thread Francisco Figueiredo Jr.
Em 12/11/2013 03:37, Brian Crowell br...@fluggo.com escreveu:

 On Mon, Nov 11, 2013 at 10:51 PM, Brian Crowell br...@fluggo.com wrote:
  I think I'm getting closer though. I have psql on Windows successfully
  authenticating, so I can't be too far off.

 Got it.

 The NpgsqlPasswordPacket class has a bug: a utility function it calls
 appends a null character to the data, which completely screws up
 GSSAPI. Now that I fixed that, I've got successful integrated
 authentication from Windows to PostgreSQL on Linux.


That's great!

We have made a lot of changes to those utility functions and now we have
methods which don't append that null char.

 However:

 * If I don't specify my username, Npgsql sends it in lowercase bcrowell
 * Npgsql isn't sending the realm, and I've got PostgreSQL configured
 to expect it

 Otherwise, it's working. As far as I know, the changes necessary are:

 * Use hostname in the SPN instead of IP address
 * Use kerberos package in AcquireCredentialsHandle call instead of
negotiate
 * Fix PGUtil.WriteBytes to not send the extra null (this method is
 only used by NpgsqlPasswordPacket, but this fix will most likely break
 other authentication methods)
 * As stated above, may need to specify username manually (UserName =
 bcrow...@domain.com); I want to fix this

 If I figure out the username issue, I'll submit a patch.


Excellent, Brian!

I'm looking forward your patch.
Npgsql source can be found at github.com/npgsql/Npgsql

If you need any help to understand Npgsql, please let me know.
Unfortunately as I'm not the original developer of the sspi code, I may not
be very helpful on this specific issue, but I can help you out regarding
other parts of Npgsql code.

 Also, in my case, it doesn't seem to matter for the SPN whether the
 service name is postgres or POSTGRES. I've got PostgreSQL set to
 postgres, and Npgsql is specifying POSTGRES, but I also at some
 point configured two sets of SPNs on the domain for uppercase and
 lowercase, so I don't know if that's a mitigating factor.


It would be awesome if you could write a little guide about how to
configure PostgreSQL to work with sspi authentication from Windows.
I could add it to our Npgsql user manual...

Thank you all for having a look at those Npgsql authentication issues.

 —Brian


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-12 Thread Francisco Figueiredo Jr.
On Tue, Nov 12, 2013 at 4:17 PM, Brian Crowell br...@fluggo.com wrote:

 On Tue, Nov 12, 2013 at 5:45 AM, Francisco Figueiredo Jr.
 franci...@npgsql.org wrote:
  I'm looking forward your patch.
  Npgsql source can be found at github.com/npgsql/Npgsql

 I figured out the username issue, and so I've sent a pull request:
 https://github.com/npgsql/Npgsql/pull/95



Excellent, Brian! Thank you very much. I'll review and merge it.
Before hand I think it will conflict with another pending pull request I'm
also reviewing: https://github.com/npgsql/Npgsql/pull/85
But I'll let you know if there is any problem with it.



 I encountered an issue where connection pooling doesn't distinguish
 between Integrated Security users. I tried to fix that. Hopefully it's
 ship-shape.


That's true. Npgsql connection pooling uses the connectionstring as a key
to the connection pool table. As the username isn't specified in the
connection string, Npgsql will handle connections from different integrated
security users as from the same pool.

I think your approach to freeze the user name is the best one to
distinguish the connections from the pool.




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior


Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-05 Thread Francisco Figueiredo Jr.
On Tue, Nov 5, 2013 at 2:35 PM, Christian Ullrich ch...@chrullrich.netwrote:

 * Stephen Frost wrote:

  * Brian Crowell (br...@fluggo.com) wrote:

 However, the eventual goal was to connect to this same server from a
 .NET app running on Windows, and here I've run into a snag. The Npgsql
 library does not support GSSAPI—it only supports SSPI, which is
 nearly-but-not-enough-like the same thing to count in this situation,


 Uhhh, why not?


 Because the server on Linux sends AUTH_REQ_GSS, which Npgsql does not
 recognize.

 I tried to fix it using the reverse of they one-line fix that worked in
 both JDBC and libpq. There, the problem was that they only supported GSSAPI
 and had no clue about SSPI (except libpq on Windows). The fix was to
 basically declare GSSAPI and SSPI to be the same. It didn't work.

 In Npgsql's case, the problem is the other way around -- it only knows
 SSPI. While making GSSAPI the same as SSPI should work in principle, there
 must be some difference somewhere.



Did you make your changes in the NpgsqlState.cs file?


Also, while checking this part of the code, it seems Npgsql isn't handling
the AuthenticationGSS message. It is only handling
AuthenticationGSSContinue messages.

I think you could try adding the  AuthenticationGSS case to Npgsql and see
if it can authenticate correctly. You could add a second switch case below
the
case AuthenticationRequestType.AuthenticationSSPI and see if Npgsql can
also handle the GSS authentication correctly.

I didn't write SSPI support code so I'm sorry I'm not being able to provide
you with a much better explanation about this problem.

I hope it helps.






  --
 Christian






 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior


Re: [GENERAL] Git host for postgresql related projects

2013-04-14 Thread Francisco Figueiredo Jr.
Thanks for the tip, Samit. I didn't know about Assembla.


On Sun, Apr 14, 2013 at 5:52 AM, Sumit Raja 
sumit.r...@raja-consulting.co.uk wrote:

 Assembla does free git repositories as well http://www.assembla.com/


 On 14 April 2013 05:22, Francisco Figueiredo Jr. franci...@npgsql.orgwrote:


 Hi, Magnus!

 How you doing?


 Today I have a mirror at github which I'm using to test and learn git
 and it seems to be very good. Git is very powerful and it is easy to
 understand why many are working on it.

 Thanks for your help and advice on this subject.



 On Sat, Apr 13, 2013 at 4:12 PM, Magnus Hagander mag...@hagander.netwrote:

 On Sat, Apr 13, 2013 at 9:10 PM, Francisco Figueiredo Jr.
 franci...@npgsql.org wrote:
 
  Hi all!
 
 
  I was thinking about moving Npgsql from cvs to another SCM. Possibly
 git.
 
  I'd like to know if there is any postgresql project host which
 supports git
  which you could recommend.
 
  I know there is git.postgresql.org and github.
 
  From the new repository page of git.postgresql.org it says: [...] If
 you
  want to to use git, while also getting some of the features that are on
  pgfoundry, we strongly advise you to look at github. [...]
 
  It would be better for me, then, to use github? As this clearly is my
 case.
 
  Thanks in advance for your help and advice.

 I would suggest going with github. They provide you with a bunch of
 services like a wiki and an issue tracker that you will not get from
 git.postgesql.org. They also provide you with the social coding
 stuff or whatever they call it (their forking/pull request/whatnot
 stuff) if you like it - but you can also just use it as a pure git
 repo if you prefer.

 --
  Magnus Hagander
  Me: http://www.hagander.net/
  Work: http://www.redpill-linpro.com/




 --
 Regards,

 Francisco Figueiredo Jr.
 Npgsql Lead Developer
 http://www.npgsql.org
 http://gplus.to/franciscojunior
 http://fxjr.blogspot.com
 http://twitter.com/franciscojunior




 --
 Raja Consulting Ltd.
 Incorporated in England and Wales No. 06454814,  Registered Office: 4
 Calder Court, Shorebury Point, Amy Johnson Way, Blackpool FY4 2RH




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior


[GENERAL] Git host for postgresql related projects

2013-04-13 Thread Francisco Figueiredo Jr.
Hi all!


I was thinking about moving Npgsql from cvs to another SCM. Possibly git.

I'd like to know if there is any postgresql project host which supports git
which you could recommend.

I know there is git.postgresql.org and github.

From the new repository page of git.postgresql.org it says: [...] If you
want to to use git, while also getting some of the features that are on
pgfoundry, we strongly advise you to look at github http://github.com/.
[...]

It would be better for me, then, to use github? As this clearly is my case.

Thanks in advance for your help and advice.



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior


Re: [GENERAL] Git host for postgresql related projects

2013-04-13 Thread Francisco Figueiredo Jr.
Hi, Magnus!

How you doing?


Today I have a mirror at github which I'm using to test and learn git and
it seems to be very good. Git is very powerful and it is easy to understand
why many are working on it.

Thanks for your help and advice on this subject.



On Sat, Apr 13, 2013 at 4:12 PM, Magnus Hagander mag...@hagander.netwrote:

 On Sat, Apr 13, 2013 at 9:10 PM, Francisco Figueiredo Jr.
 franci...@npgsql.org wrote:
 
  Hi all!
 
 
  I was thinking about moving Npgsql from cvs to another SCM. Possibly git.
 
  I'd like to know if there is any postgresql project host which supports
 git
  which you could recommend.
 
  I know there is git.postgresql.org and github.
 
  From the new repository page of git.postgresql.org it says: [...] If
 you
  want to to use git, while also getting some of the features that are on
  pgfoundry, we strongly advise you to look at github. [...]
 
  It would be better for me, then, to use github? As this clearly is my
 case.
 
  Thanks in advance for your help and advice.

 I would suggest going with github. They provide you with a bunch of
 services like a wiki and an issue tracker that you will not get from
 git.postgesql.org. They also provide you with the social coding
 stuff or whatever they call it (their forking/pull request/whatnot
 stuff) if you like it - but you can also just use it as a pure git
 repo if you prefer.

 --
  Magnus Hagander
  Me: http://www.hagander.net/
  Work: http://www.redpill-linpro.com/




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior


Re: [GENERAL] Problem in Set search path

2013-03-25 Thread Francisco Figueiredo Jr.
Did you try to set the search_path in the connection string? This way you
won't need to set the search_path manually. Npgsql will take care of it to
you.

I hope it helps.



On Fri, Mar 22, 2013 at 1:07 AM, Kalai R softlinne...@gmail.com wrote:



 -- Forwarded message --
 From: Kalai R softlinne...@gmail.com
 Date: Fri, Mar 22, 2013 at 9:36 AM
 Subject: Re: [GENERAL] Problem in Set search path
 To: Alban Hertroys haram...@gmail.com


 Hi,

 Is that the same connection object in ,NET or the same connection to a
 connection pool or the same database connection? That's not necessarily the
 same.
 I use the same npgsql connection object in .net


 Might try temporarily turning up the logging in postgresql.conf to 'all'
 and see what is actually being done on the server.

 Did you know you can set a search_path on user (role) objects and on
 database objects in the database? That might just take out your need to
 specify it in your ,NET application.

 I try to find out my problem by your ideas. Thanks guys.

 Regards
 Kalai





-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior


Re: [GENERAL] Npgsql

2012-11-26 Thread Francisco Figueiredo Jr.
 You should check if npgsql has been correctly installed in the gac by
running gac -l Npgsql. If it is it will return something.

 Another possibility is to add a folder called bin to the root of your web
app and put npgsql.dll and mono.security. dll inside.

 I hope it helps.

 Em 26/11/2012 17:56, Peter Kroon plakr...@gmail.com escreveu:

 The actual error message was in Dutch. In my previous post I've added:
 It's unable to find/load dependencies. That's the translation.

 I don't have a project. I have a vb.net page, like - Default.aspx
 I used the stackbuilder to install Npgsql and altered nothing else.


 2012/11/26 Glyn Astill glynast...@yahoo.co.uk

 An actual error message would be useful, but did you add a reference to
the assembly in your project?


 
 From: Peter Kroon plakr...@gmail.com
 To: pgsql-general@postgresql.org pgsql-general@postgresql.org
 Sent: Friday, 23 November 2012, 18:13
 Subject: [GENERAL] Npgsql

 I've installed Npgsql via Application stack builder without a
problem(I guess, no error messages seen).

 http://npgsql.projects.pgfoundry.org/docs/manual/UserManual.html
 The projectpage tells me I have to add:

 %@ Assembly name=System.Data %
 %@ Assembly name=Npgsql %


 When I do this I get an error:

 Regel 1:  %@ Page Language=VB Debug=true %
 Regel 2:  %@ Import Namespace=System.Data.Odbc %
 Regel 3:  %@ Assembly name=Npgsql %
 Regel 4:  %
 Regel 5:

 It's unable to find/load dependencies.
 Has anyone ever encountered this problem?
 If so, what was your solution.

 Thanks,

 Peter






Re: [GENERAL] Npgsql

2012-11-26 Thread Francisco Figueiredo Jr.
Ok, and what about mono.security? Npgsql depends on it and it should be in
the gac as well.
 Em 26/11/2012 18:36, Peter Kroon plakr...@gmail.com escreveu:

 It appears to be installed.

 C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Toolsgacutil
 -l Npgsql
 Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.17626
 Copyright (c) Microsoft Corporation.  All rights reserved.

 The Global Assembly Cache contains the following assemblies:
   Npgsql, Version=2.0.12.0, Culture=neutral,
 PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL

 Number of items = 1


 2012/11/26 Francisco Figueiredo Jr. francisco.figueiredo...@gmail.com

 gac -l Npgsql





Re: [GENERAL] Npgsql

2012-11-26 Thread Francisco Figueiredo Jr.
Hm, this is very strange. Somehow your vb. Net isn't able to find
npgsql in the gac. Do you have more than one .net installation?

Also, can you try to add a bin folder in the root of your web app and put
npgsql.dll and mono.security there?

Sorry for not being very helpful.
Em 26/11/2012 18:51, Peter Kroon plakr...@gmail.com escreveu:

 Installed as well.

 C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Toolsgacutil
 -l mono.security
 Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.17626
 Copyright (c) Microsoft Corporation.  All rights reserved.

 The Global Assembly Cache contains the following assemblies:
   mono.security, Version=2.0.0.0, Culture=neutral,
 PublicKeyToken=0738eb9f132ed7
 56, processorArchitecture=MSIL

 Number of items = 1


 2012/11/26 Francisco Figueiredo Jr. franci...@npgsql.org


 Ok, and what about mono.security? Npgsql depends on it and it should be
 in the gac as well.
  Em 26/11/2012 18:36, Peter Kroon plakr...@gmail.com escreveu:

 It appears to be installed.

 C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0
 Toolsgacutil -l Npgsql
 Microsoft (R) .NET Global Assembly Cache Utility.  Version
 4.0.30319.17626
 Copyright (c) Microsoft Corporation.  All rights reserved.

 The Global Assembly Cache contains the following assemblies:
   Npgsql, Version=2.0.12.0, Culture=neutral,
 PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL

 Number of items = 1


 2012/11/26 Francisco Figueiredo Jr. francisco.figueiredo...@gmail.com

 gac -l Npgsql






Re: [GENERAL] Npgsql

2012-11-26 Thread Francisco Figueiredo Jr.
Yes. It would not be advisable to do that but at least you could check you
are able to use npgsql.

The best way would to create a Web application and put your files there.

I hope it helps.
Em 26/11/2012 19:02, Peter Kroon plakr...@gmail.com escreveu:

 Do you have more than one .net installation?
 Yes 2 and 4.
 I've tried with both pools and get same result.

 Also, can you try to add a bin folder in the root of your web app and put
 npgsql.dll and mono.security there?
 You mean create a folder called bin in: C:\inetpub\wwwroot ?


 2012/11/26 Francisco Figueiredo Jr. franci...@npgsql.org


 Hm, this is very strange. Somehow your vb. Net isn't able to find
 npgsql in the gac. Do you have more than one .net installation?

 Also, can you try to add a bin folder in the root of your web app and put
 npgsql.dll and mono.security there?

 Sorry for not being very helpful.
 Em 26/11/2012 18:51, Peter Kroon plakr...@gmail.com escreveu:

 Installed as well.

 C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0
 Toolsgacutil -l mono.security
 Microsoft (R) .NET Global Assembly Cache Utility.  Version
 4.0.30319.17626
 Copyright (c) Microsoft Corporation.  All rights reserved.

 The Global Assembly Cache contains the following assemblies:
   mono.security, Version=2.0.0.0, Culture=neutral,
 PublicKeyToken=0738eb9f132ed7
 56, processorArchitecture=MSIL

 Number of items = 1


 2012/11/26 Francisco Figueiredo Jr. franci...@npgsql.org


 Ok, and what about mono.security? Npgsql depends on it and it should be
 in the gac as well.
  Em 26/11/2012 18:36, Peter Kroon plakr...@gmail.com escreveu:

 It appears to be installed.

 C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0
 Toolsgacutil -l Npgsql
 Microsoft (R) .NET Global Assembly Cache Utility.  Version
 4.0.30319.17626
 Copyright (c) Microsoft Corporation.  All rights reserved.

 The Global Assembly Cache contains the following assemblies:
   Npgsql, Version=2.0.12.0, Culture=neutral,
 PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL

 Number of items = 1


 2012/11/26 Francisco Figueiredo Jr. francisco.figueiredo...@gmail.com
 

 gac -l Npgsql







Re: [GENERAL] Another question about Range types

2012-08-03 Thread Francisco Figueiredo Jr.
Thanks!
Em 03/08/2012 17:25, Mike Christensen m...@kitchenpc.com escreveu:

 Done.  Bug #1011216

 On Fri, Aug 3, 2012 at 1:11 PM, Francisco Figueiredo Jr.
 francisco.figueiredo...@gmail.com wrote:
 
  Regarding npgsql, range types have no direct mapping so they will be
 treated
  like strings. Sorry for that.
 
  I'll work to add support to it. Would you mind to fill a feature request
  about that on our feature requests project page?
 http://project.npgsql.org
 
  Thanks in advance.
 
  Em 03/08/2012 17:01, Mike Christensen m...@kitchenpc.com escreveu:
 
  There's another ongoing thread about range types, which was great
  because I wasn't familiar with the feature (guess it's new in 9.2?).
 
  I run a recipe website and was looking for *exactly* this sort of
  feature a few weeks ago when I was adding in support for ranges of
  ingredients (such as 1-2tsp salt).  In the end, I implemented it
  using two columns (QtyHigh and QtyLow).  In the salt example, QtyHigh
  would be 2 and QtyLow would be 1.  I also have some CHECK constraints
  to make sure high is always higher, and they're not the same, and not
  negative or anything.
 
  Now, for 99% of the ingredients, QtyHigh would have a value and QtyLow
  would just be null.  For example, 2tsp salt would have a QtyHigh of
  2 and a QtyLow of null, which would indicate there is no range.
 
  I'm curious if I could combine these columns into one using a RANGE
  type.  Obviously, if the column only stored ranges, it would be easy.
  However, can a range also be one-dimensional?  Can I have a High value
  and no low value?  Or would the recommended design be to have high/low
  be the same?  Overall, would this scenario be an appropriate use case
  for this RANGE type, since only some of the data are ranges?
 
  BONUS Question:
 
  How are RANGE types represented in Npgsql, or are they even supported
 yet?
 
  Mike
 
  --
  Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
  To make changes to your subscription:
  http://www.postgresql.org/mailpref/pgsql-general



Re: [GENERAL] Another question about Range types

2012-08-03 Thread Francisco Figueiredo Jr.
Regarding npgsql, range types have no direct mapping so they will be
treated like strings. Sorry for that.

I'll work to add support to it. Would you mind to fill a feature request
about that on our feature requests project page? http://project.npgsql.org

Thanks in advance.
Em 03/08/2012 17:01, Mike Christensen m...@kitchenpc.com escreveu:

 There's another ongoing thread about range types, which was great
 because I wasn't familiar with the feature (guess it's new in 9.2?).

 I run a recipe website and was looking for *exactly* this sort of
 feature a few weeks ago when I was adding in support for ranges of
 ingredients (such as 1-2tsp salt).  In the end, I implemented it
 using two columns (QtyHigh and QtyLow).  In the salt example, QtyHigh
 would be 2 and QtyLow would be 1.  I also have some CHECK constraints
 to make sure high is always higher, and they're not the same, and not
 negative or anything.

 Now, for 99% of the ingredients, QtyHigh would have a value and QtyLow
 would just be null.  For example, 2tsp salt would have a QtyHigh of
 2 and a QtyLow of null, which would indicate there is no range.

 I'm curious if I could combine these columns into one using a RANGE
 type.  Obviously, if the column only stored ranges, it would be easy.
 However, can a range also be one-dimensional?  Can I have a High value
 and no low value?  Or would the recommended design be to have high/low
 be the same?  Overall, would this scenario be an appropriate use case
 for this RANGE type, since only some of the data are ranges?

 BONUS Question:

 How are RANGE types represented in Npgsql, or are they even supported yet?

 Mike

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general



Re: [GENERAL] 9.1 causing out of shared memory error and higher serialization conflicts

2012-03-09 Thread Francisco Figueiredo Jr.
Thanks for the heads up.

I'll fix that in Npgsql so it sends the correct isolation level when
running on 9.1+

Sent from my Android phone
On Mar 9, 2012 3:27 PM, Randy Ficker randyfic...@gmail.com wrote:

 Hey Marti,

 I almost replied that yes, I was 100% sure, since I know my code requests
 the REPEATABLE READ level.  However, I figured before I replied, I should
 double-check the SQL statements that were being sent to Postgres.

 Then I found this gem in Npgsql:

if (isolation == IsolationLevel.RepeatableRead || isolation ==
 IsolationLevel.Serializable || isolation == IsolationLevel.Snapshot)
{
commandText.Append(SERIALIZABLE);
}

 *headslap*.  I know this code is fine for 8, but I still would not have
 expected this code to exist in the driver itself instead of just letting
 Postgres do the switch.  I guess Npgsql says right on their front page
 Works with Postgresql 7.x and 8.x so I shouldn't have assumed it'd behave
 correctly with 9.

 So you're right, it turns out I was using SERIALIZABLE after all.  I'm
 going to fix this right away.  Thanks for the reply!

 -Original Message-
 From: Marti Raudsepp [mailto:ma...@juffo.org]
 Sent: Friday, March 09, 2012 9:41 AM
 To: Randy Ficker
 Cc: pgsql-general@postgresql.org
 Subject: Re: [GENERAL] 9.1 causing out of shared memory error and higher
 serialization conflicts

 On Fri, Mar 9, 2012 at 19:16, Randy Ficker randyfic...@gmail.com wrote:
  Most writing transactions are using the REPEATABLE READ isolation
  level (the SERIALIZABLE level is not used at all).

 Are you 100% sure about this? A major thing that changed in 9.1 was
 implementation for proper SERIALIZABLE isolation, which could indeed cause
 the sort of errors you described. Previously, asking for SERIALIZABLE level
 gave you REPEATABLE READ.

 As far as I can tell, the max_pred_locks_per_transaction setting is
 irrelevant for isolation levels lower than SERIALIZABLE.

 What's your default_transaction_isolation set to?

 Regards,
 Marti


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general



Re: [GENERAL] 9.1 causing out of shared memory error and higher serialization conflicts

2012-03-09 Thread Francisco Figueiredo Jr.
Would you mind to fill a bug report about that and also provide your fix so
we can apply in the main codebase?
Thanks in advance!

Sent from my Android phone
On Mar 9, 2012 5:12 PM, Randy Ficker randyfic...@gmail.com wrote:

 After deploying a fixed version of Npgsql, the error frequency went
 straight back down to the 8.4 level.  Awesome!

 ** **

 Thanks for the quick replies guys!

 ** **

 *From:* francisco.figueiredo...@gmail.com [mailto:
 francisco.figueiredo...@gmail.com] *On Behalf Of *Francisco Figueiredo Jr.
 *Sent:* Friday, March 09, 2012 10:36 AM
 *To:* Randy Ficker
 *Cc:* pgsql-general@postgresql.org; Marti Raudsepp
 *Subject:* Re: [GENERAL] 9.1 causing out of shared memory error and
 higher serialization conflicts

 ** **


 Thanks for the heads up. 

 I'll fix that in Npgsql so it sends the correct isolation level when
 running on 9.1+ 

 Sent from my Android phone

 On Mar 9, 2012 3:27 PM, Randy Ficker randyfic...@gmail.com wrote:

 Hey Marti,

 I almost replied that yes, I was 100% sure, since I know my code requests
 the REPEATABLE READ level.  However, I figured before I replied, I should
 double-check the SQL statements that were being sent to Postgres.

 Then I found this gem in Npgsql:

if (isolation == IsolationLevel.RepeatableRead || isolation ==
 IsolationLevel.Serializable || isolation == IsolationLevel.Snapshot)
{
commandText.Append(SERIALIZABLE);
}

 *headslap*.  I know this code is fine for 8, but I still would not have
 expected this code to exist in the driver itself instead of just letting
 Postgres do the switch.  I guess Npgsql says right on their front page
 Works with Postgresql 7.x and 8.x so I shouldn't have assumed it'd behave
 correctly with 9.

 So you're right, it turns out I was using SERIALIZABLE after all.  I'm
 going to fix this right away.  Thanks for the reply!

 -Original Message-
 From: Marti Raudsepp [mailto:ma...@juffo.org]
 Sent: Friday, March 09, 2012 9:41 AM
 To: Randy Ficker
 Cc: pgsql-general@postgresql.org
 Subject: Re: [GENERAL] 9.1 causing out of shared memory error and higher
 serialization conflicts

 On Fri, Mar 9, 2012 at 19:16, Randy Ficker randyfic...@gmail.com wrote:
  Most writing transactions are using the REPEATABLE READ isolation
  level (the SERIALIZABLE level is not used at all).

 Are you 100% sure about this? A major thing that changed in 9.1 was
 implementation for proper SERIALIZABLE isolation, which could indeed cause
 the sort of errors you described. Previously, asking for SERIALIZABLE level
 gave you REPEATABLE READ.

 As far as I can tell, the max_pred_locks_per_transaction setting is
 irrelevant for isolation levels lower than SERIALIZABLE.

 What's your default_transaction_isolation set to?

 Regards,
 Marti


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general



Re: [GENERAL] 9.1 causing out of shared memory error and higher serialization conflicts

2012-03-09 Thread Francisco Figueiredo Jr.
Thanks!
I'll make the changes to Npgsql source code.

Sent from my Android phone
On Mar 9, 2012 7:17 PM, Randy Ficker randyfic...@gmail.com wrote:

 Filed:
 http://pgfoundry.org/tracker/index.php?func=detailaid=1011174group_id=1000140atid=590
 

 ** **

 *From:* francisco.figueiredo...@gmail.com [mailto:
 francisco.figueiredo...@gmail.com] *On Behalf Of *Francisco Figueiredo Jr.
 *Sent:* Friday, March 09, 2012 12:41 PM
 *To:* Randy Ficker
 *Cc:* Marti Raudsepp; pgsql-general@postgresql.org
 *Subject:* RE: [GENERAL] 9.1 causing out of shared memory error and
 higher serialization conflicts

 ** **


 Would you mind to fill a bug report about that and also provide your fix
 so we can apply in the main codebase?
 Thanks in advance! 

 Sent from my Android phone

 On Mar 9, 2012 5:12 PM, Randy Ficker randyfic...@gmail.com wrote:

 After deploying a fixed version of Npgsql, the error frequency went
 straight back down to the 8.4 level.  Awesome!

  

 Thanks for the quick replies guys!

  

 *From:* francisco.figueiredo...@gmail.com [mailto:
 francisco.figueiredo...@gmail.com] *On Behalf Of *Francisco Figueiredo Jr.
 *Sent:* Friday, March 09, 2012 10:36 AM
 *To:* Randy Ficker
 *Cc:* pgsql-general@postgresql.org; Marti Raudsepp
 *Subject:* Re: [GENERAL] 9.1 causing out of shared memory error and
 higher serialization conflicts

  


 Thanks for the heads up. 

 I'll fix that in Npgsql so it sends the correct isolation level when
 running on 9.1+ 

 Sent from my Android phone

 On Mar 9, 2012 3:27 PM, Randy Ficker randyfic...@gmail.com wrote:

 Hey Marti,

 I almost replied that yes, I was 100% sure, since I know my code requests
 the REPEATABLE READ level.  However, I figured before I replied, I should
 double-check the SQL statements that were being sent to Postgres.

 Then I found this gem in Npgsql:

if (isolation == IsolationLevel.RepeatableRead || isolation ==
 IsolationLevel.Serializable || isolation == IsolationLevel.Snapshot)
{
commandText.Append(SERIALIZABLE);
}

 *headslap*.  I know this code is fine for 8, but I still would not have
 expected this code to exist in the driver itself instead of just letting
 Postgres do the switch.  I guess Npgsql says right on their front page
 Works with Postgresql 7.x and 8.x so I shouldn't have assumed it'd behave
 correctly with 9.

 So you're right, it turns out I was using SERIALIZABLE after all.  I'm
 going to fix this right away.  Thanks for the reply!

 -Original Message-
 From: Marti Raudsepp [mailto:ma...@juffo.org]
 Sent: Friday, March 09, 2012 9:41 AM
 To: Randy Ficker
 Cc: pgsql-general@postgresql.org
 Subject: Re: [GENERAL] 9.1 causing out of shared memory error and higher
 serialization conflicts

 On Fri, Mar 9, 2012 at 19:16, Randy Ficker randyfic...@gmail.com wrote:
  Most writing transactions are using the REPEATABLE READ isolation
  level (the SERIALIZABLE level is not used at all).

 Are you 100% sure about this? A major thing that changed in 9.1 was
 implementation for proper SERIALIZABLE isolation, which could indeed cause
 the sort of errors you described. Previously, asking for SERIALIZABLE level
 gave you REPEATABLE READ.

 As far as I can tell, the max_pred_locks_per_transaction setting is
 irrelevant for isolation levels lower than SERIALIZABLE.

 What's your default_transaction_isolation set to?

 Regards,
 Marti


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general



Re: [GENERAL] Is there a reason why Postgres doesn't have Byte or tinyint?

2012-01-11 Thread Francisco Figueiredo Jr.
 and compile Npgsql.

 2. Try to use a Bit datatype. Npgsql has a BitString datatype which
 maps to postgresql bit fields which could give you the information you
 want. But I don't know if it would be too much overkill for your
 rating system.
 BitString datatype already have a lot of helpers methods though
 including one which translates the bitstring to a byte value which I
 think would be helpful to you.

 Thanks so much for your help!

 I bet the BitString (this is basically a representation of a bitmask,
 I take it) would work perfectly for representing a 0-5 rating, plus
 maybe a bit at the end for representing the half star or something.
 However, I think it's a bit overkill at the moment when the
 alternative is just cast an Int16 to a Byte, or just use an Int16 to
 represent the rating in the first place.  Creating a customized
 version of the source equally so, though I'd love to dig into the
 source when I have some free time (oh wait, KitchenPC /is/ my free
 time)..

 I cannot say +1 enough to the idea of implementing custom type
 conversions though - Even if it's a quick and dirty solution.  I would
 definitely love the idea of Npgsql converting database ENUMs to my own
 C# matching enums, or DOMAINs to instances of my own C# classes (such
 as the Rating class).  I already do a little bit of this through
 NHibernate, and it works pretty well, but it only works through the
 ORM and not when I query directly.  If you ever have a free weekend of
 a long flight to get something working, I'll owe you a drink and be
 the first in line to thoroughly test it for you!

 Mike


Well, the idea of custom type conversions are exactly the Domain
support to your own c# classes :)

The idea would be possible to register custom types with Npgsql
alongside their converters. I don't know if there was a way to create
a generic converter, but being able to register custom converters is
already a big step in the direction of supporting postgresql custom
domain types.

Today Npgsql has support to send you enum value to the database. You
can see an example of that in the EnumSupport method of our test
suite. I reproduce it here for easy reading:

[Test]
public void EnumSupport()
{
NpgsqlCommand command = new NpgsqlCommand(insert into
tableb(field_int2) values (:a), TheConnection);

command.Parameters.Add(new NpgsqlParameter(a,
NpgsqlDbType.Smallint));

command.Parameters[0].Value = EnumTest.Value1;


Int32 rowsAdded = command.ExecuteNonQuery();

Assert.AreEqual(1, rowsAdded);
}


It is a simple support but it could help you in your task.

I think the other way around would need more work as Npgsql would need
to know how the value from database map to which enum value. But for
while, you could make the conversion manually in your client code to
your enum.

I hope it helps.


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Is there a reason why Postgres doesn't have Byte or tinyint?

2012-01-09 Thread Francisco Figueiredo Jr.
On Sun, Jan 8, 2012 at 21:31, Mike Christensen m...@kitchenpc.com wrote:
 On Sun, Jan 8, 2012 at 10:12 AM, Francisco Figueiredo Jr.
 franci...@npgsql.org wrote:
 On Sun, Jan 8, 2012 at 06:54, Mike Christensen m...@kitchenpc.com wrote:
 According to the manuals, Postgres has smallint (2 byte), integer (4
 bytes) and bigint (8 bytes)..  I use a lot of structures with bytes
 in my code and it's kinda annoying to cast DB output from Int16 to
 Byte every time, especially since there's no explicit cast in .NET and
 you have to use System.Convert().

 Is there a work-around, or do people just cast or use Int16 in their
 data structures?  Just wondering..  I know on modern computers it
 probably doesn't make any difference anyway..


 Is this just about programmer convenience or is it about space 
 efficiency
 in
 the database?  BYTEA might help you.  Or try declaring a DOMAIN over
 SMALLINT that limits allowed values to the range of a byte. -- Darren
 Duncan


 This is purely programmer convenience.

 Basically, I want Npgsql to marshal the value as a .NET Byte type, if
 I can find a way to do that I'm happy.  Perhaps it's more of a Npgsql
 question, though I'm curious as to why Postgres doesn't have an
 intrinsic tinyint or byte type.


 Maybe Postgres doesn't need a Byte type predefined because it gives you 
 the
 means to define the type yourself, such as using DOMAIN.

 Generally speaking, I believe it is more important for a type system to
 provide the means for arbitrary user-defined types which can be used in 
 all
 the places as built-in-defined types, than to have large numbers of
 built-in-defined types.

 Precisely.  postgresql's extensable nature allows you to build your
 own types as well.  If it's popular enough it'll make it into contrib,
 then maybe core.  My guess is that there's some non-trivial cost to
 maintaining each core type, and since a byte type isn't required by
 the SQL spec, it would take some effort to get a standard one included
 in the core.

 That makes sense.

 I guess my question is more of a NpgSql question then.  Is there a way
 to create a custom PG type, and have npgsql serialize that type in a
 dataset to a .NET Byte type?

 I'd probably be better off posting on the npgsql mailing list, but
 perhaps someone here knows as well..



 Hi!

 Npgsql already has support to map .Net byte data type to int2 and vice-versa.

 You can see all the supported type mappings in this file:
 http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/npgsql/Npgsql2/src/NpgsqlTypes/NpgsqlTypesHelper.cs?rev=1.41content-type=text/x-cvsweb-markup

 Check method PrepareDefaultTypesMap().

 I hope it helps.

 Thanks!  I'll have to mess around with this a bit more..  From what
 I've seen so far, functions that have int2 out parameters will return
 Int16 through the DataReader..  Maybe I'm doing something wrong..

 Mike


I think you aren't doing anything wrong. int2 postgresql datatypes are
supposed to be mapped to .net int16 types.

Do you have a simple example?

What type were you expecting in the datareader? Maybe there is a
missing mapping in Npgsql.

Thanks in advance.


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Is there a reason why Postgres doesn't have Byte or tinyint?

2012-01-09 Thread Francisco Figueiredo Jr.
 to use a Bit datatype. Npgsql has a BitString datatype which
maps to postgresql bit fields which could give you the information you
want. But I don't know if it would be too much overkill for your
rating system.
BitString datatype already have a lot of helpers methods though
including one which translates the bitstring to a byte value which I
think would be helpful to you.

I hope it helps.



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Is there a reason why Postgres doesn't have Byte or tinyint?

2012-01-08 Thread Francisco Figueiredo Jr.
On Sun, Jan 8, 2012 at 06:54, Mike Christensen m...@kitchenpc.com wrote:
 According to the manuals, Postgres has smallint (2 byte), integer (4
 bytes) and bigint (8 bytes)..  I use a lot of structures with bytes
 in my code and it's kinda annoying to cast DB output from Int16 to
 Byte every time, especially since there's no explicit cast in .NET and
 you have to use System.Convert().

 Is there a work-around, or do people just cast or use Int16 in their
 data structures?  Just wondering..  I know on modern computers it
 probably doesn't make any difference anyway..


 Is this just about programmer convenience or is it about space efficiency
 in
 the database?  BYTEA might help you.  Or try declaring a DOMAIN over
 SMALLINT that limits allowed values to the range of a byte. -- Darren
 Duncan


 This is purely programmer convenience.

 Basically, I want Npgsql to marshal the value as a .NET Byte type, if
 I can find a way to do that I'm happy.  Perhaps it's more of a Npgsql
 question, though I'm curious as to why Postgres doesn't have an
 intrinsic tinyint or byte type.


 Maybe Postgres doesn't need a Byte type predefined because it gives you the
 means to define the type yourself, such as using DOMAIN.

 Generally speaking, I believe it is more important for a type system to
 provide the means for arbitrary user-defined types which can be used in all
 the places as built-in-defined types, than to have large numbers of
 built-in-defined types.

 Precisely.  postgresql's extensable nature allows you to build your
 own types as well.  If it's popular enough it'll make it into contrib,
 then maybe core.  My guess is that there's some non-trivial cost to
 maintaining each core type, and since a byte type isn't required by
 the SQL spec, it would take some effort to get a standard one included
 in the core.

 That makes sense.

 I guess my question is more of a NpgSql question then.  Is there a way
 to create a custom PG type, and have npgsql serialize that type in a
 dataset to a .NET Byte type?

 I'd probably be better off posting on the npgsql mailing list, but
 perhaps someone here knows as well..



Hi!

Npgsql already has support to map .Net byte data type to int2 and vice-versa.

You can see all the supported type mappings in this file:
http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/npgsql/Npgsql2/src/NpgsqlTypes/NpgsqlTypesHelper.cs?rev=1.41content-type=text/x-cvsweb-markup

Check method PrepareDefaultTypesMap().

I hope it helps.




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] What's the best way in Postgres9 to store a bunch of arbitrary boolean values for a row?

2011-12-05 Thread Francisco Figueiredo Jr.
Currently, Npgsql doesn't support hstore datatype.

It will be sent and received as text from Npgsql.

I hope it helps.



On Mon, Dec 5, 2011 at 09:25, Craig Ringer ring...@ringerc.id.au wrote:

 On 12/05/2011 03:31 PM, Mike Christensen wrote:

 That'll get slow. It'll work and is IMO better than all the other options
 you suggested, but I'd probably favour hstore over it.

 The hstore module sounds fantastic!

 I'm curious as to how these columns are serialized back through the
 driver, such as Npgsql.  Do I get the values as strings, such as a
 comma delimited key/value pair list?  Or would I need to do some
 custom logic to deserialize them?


 It depends on what Npgsql supports, really. The server sends hstore values
 as text; what the client does with them depends on the client. I don't
 really do C# and .NET so I'm not the one to turn to for advice on that side.
 Ideally a hstore would be parsed and converted to a hash map by the database
 driver. At present I don't know of any that do this natively, though I may
 well be out of date on this. For PgJDBC there's code around (not AFAIK yet
 integrated into PgJDBC proper) to do it.

 In many (most?) cases you'll want to interact with hstore fields using the
 hstore-provided types and operators, eg.

 SELECT somefield SET hstorecol = hstorecol - somekey;

 See: http://www.postgresql.org/docs/current/static/hstore.html

 If you're working via some ORM layer (as it sounds like) you may have to use
 native queries or explain to it about the hstore types and operators. That's
 the usual problem when trying to use database-specific not-quite-relational
 features like hstore through a layer that tries to be db-independent and
 purely relational. I don't have any experience with Castle ActiveRecord.
 When I've used hstore with hibernate I've always done it by direct native
 queries.

 --
 Craig Ringer



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to add xml data to table

2011-10-08 Thread Francisco Figueiredo Jr.
I think your best bet would be to go with XmlReader as it provides a
fast read only parsing of the document.

From MS doc about linq to xml:
http://msdn.microsoft.com/en-us/library/bb387048.aspx

XmlReader is a fast, forward-only, non-caching parser.

LINQ to XML is implemented on top of XmlReader, and they are tightly
integrated. However, you can also use XmlReader by itself.

For example, suppose you are building a Web service that will parse
hundreds of XML documents per second, and the documents have the same
structure, meaning that you only have to write one implementation of
the code to parse the XML. In this case, you would probably want to
use XmlReader by itself.

In contrast, if you are building a system that parses many smaller XML
documents, and each one is different, you would want to take advantage
of the productivity improvements that LINQ to XML provides.


I think your case fits the first example.

This way you could use xmlreader to extract the values and then fill
NpgsqlParameter values and execute the insert command.

I hope it helps.



2011/10/7 Andrus Moor eetas...@online.ee:
 soap response below contains table of products, approx 5000 rows.
 Table of products (below) is nearly similar structure as xml data.

 Products table needs to be updated from xml data in every hour.

 How to add this xml data to table of products ?

 Should I use xpath() function or any other ides ?
 Using npgsql and C# in ASP .NET / Mono.

 Andrus.


 CREATE TABLE products (
 SupplierCode char(20) primary key,
 SegmentId char(8),
 GroupId char(8),
 ClassId char(8),
 SeriesId char(8),
 VendorId char(2),
 PartNumbrt char(27),
 Name Text,
 Warranty Numeric(6,2),
 Price Numeric(10,4),
 Quantity Numeric(8,2)
 )

 Data which is required to add looks like:

 ?xml version=1.0 encoding=utf-8?
 soap12:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:xsd=http://www.w3.org/2001/XMLSchema;
 xmlns:soap12=http://www.w3.org/2003/05/soapenvelope;
 soap12:Body
 GetProductListResponse xmlns=http://xxx.yy.zz/;
 GetProductListResult
 ProductList
 Product
 SupplierCode001982/SupplierCode
 SegmentId6500/SegmentId
 GroupId6501/GroupId
 ClassId65010200/ClassId
 SeriesId10001125/SeriesId
 VendorIdAM/VendorId
 PartNumberADA3000BIBOX/PartNumber
 NameAMD Athlon64 3000+ (1800MHz/L2 Cache 512KB) Socket 939, BOX/Name
 Warranty36/Warranty
 Price196.0/Price
 Quantity0/Quantity
 DateExpected1999-01-01T00:00:00/DateExpected
 IsNewProducttrue/IsNewProduct
 /Product
 Product
 SupplierCode001512/SupplierCode
 SegmentId6500/SegmentId
 GroupId6501/GroupId
 ClassId65010200/ClassId
 SeriesId10001125/SeriesId
 VendorIdAM/VendorId
 Acme API Specification v 1.0
 13
 PartNumberADA3000AXBOX/PartNumber
 NameAMD Athlon64 3000+ (2000MHz/1600MHz/L2 Cache 512KB) Socket 754,
 BOX/Name
 Warranty36/Warranty
 Price296.0/Price
 Quantity0/Quantity
 GrossWeight3.6000/GrossWeight
 DateExpected1999-01-01T00:00:00/DateExpected
 IsNewProductfalse/IsNewProduct
 /Product
 /ProductList
 /GetProductListResult
 /GetProductListResponse
 /soap12:Body
 /soap12:Envelope



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to add xml data to table

2011-10-08 Thread Francisco Figueiredo Jr.
I think this approach is much better as you can solve everything on
server itself.

About your question on http request I don't know.
Sorry for that. :(
Maybe there is a module for Postgresql which can enable you to make http calls?



On Sat, Oct 8, 2011 at 17:15, Andrus kobrule...@hot.ee wrote:
 Thank you.
 I got also the following code:

 First import the XML into a staging table:

 CREATE TABLE xml_import
 (
  xml_data  xml
 )

 with product_list as (
  select
 unnest(xpath('/soap12:Envelope/soap12:Body/pl:GetProductListResponse/pl:GetProductListResult/pl:ProductList/pl:Product',
 xml_data,
         ARRAY[ array['xsd', 'http://www.w3.org/2001/XMLSchema-instance'],
                array['soap12', 'http://www.w3.org/2003/05/soapenvelope'],
                array['pl', 'http://xxx.yy.zz/']])) as product
  from xml_import
 )
 select (xpath('/Product/SupplierCode/text()', product)::varchar[])[1] as
 suppliercode,
      (xpath('/Product/SegmentId/text()', product)::varchar[])[1] as
 segmentid,
      (xpath('/Product/PartNumber/text()', product)::varchar[])[1] as
 partnumber,
      to_number((xpath('/Product/Price/text()', product)::varchar[])[1],
 '9.9') as price,
      to_number((xpath('/Product/GrossWeight/text()',
 product)::varchar[])[1], '.') as weight
 from product_list

 Looks simpler than using XmlReader, isn't it?
 How to invoke asmx web service call (= http POST request) from
 PostgreSql server  which reads http response to xml_import  table ?

 How to call stored procedure periodically after every one hour in server?

 In this case we can create stored procedure, client side code is not
 nessecary at
 all.

 Andrus.

 -Algsõnum- From: Francisco Figueiredo Jr.
 Sent: Saturday, October 08, 2011 9:38 PM
 To: Andrus Moor
 Cc: pgsql-general@postgresql.org
 Subject: Re: [GENERAL] How to add xml data to table

 I think your best bet would be to go with XmlReader as it provides a
 fast read only parsing of the document.

 From MS doc about linq to xml:
 http://msdn.microsoft.com/en-us/library/bb387048.aspx

 XmlReader is a fast, forward-only, non-caching parser.

 LINQ to XML is implemented on top of XmlReader, and they are tightly
 integrated. However, you can also use XmlReader by itself.

 For example, suppose you are building a Web service that will parse
 hundreds of XML documents per second, and the documents have the same
 structure, meaning that you only have to write one implementation of
 the code to parse the XML. In this case, you would probably want to
 use XmlReader by itself.

 In contrast, if you are building a system that parses many smaller XML
 documents, and each one is different, you would want to take advantage
 of the productivity improvements that LINQ to XML provides.


 I think your case fits the first example.

 This way you could use xmlreader to extract the values and then fill
 NpgsqlParameter values and execute the insert command.

 I hope it helps.



 2011/10/7 Andrus Moor eetas...@online.ee:

 soap response below contains table of products, approx 5000 rows.
 Table of products (below) is nearly similar structure as xml data.

 Products table needs to be updated from xml data in every hour.

 How to add this xml data to table of products ?

 Should I use xpath() function or any other ides ?
 Using npgsql and C# in ASP .NET / Mono.

 Andrus.


 CREATE TABLE products (
 SupplierCode char(20) primary key,
 SegmentId char(8),
 GroupId char(8),
 ClassId char(8),
 SeriesId char(8),
 VendorId char(2),
 PartNumbrt char(27),
 Name Text,
 Warranty Numeric(6,2),
 Price Numeric(10,4),
 Quantity Numeric(8,2)
 )

 Data which is required to add looks like:

 ?xml version=1.0 encoding=utf-8?
 soap12:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:xsd=http://www.w3.org/2001/XMLSchema;
 xmlns:soap12=http://www.w3.org/2003/05/soapenvelope;
 soap12:Body
 GetProductListResponse xmlns=http://xxx.yy.zz/;
 GetProductListResult
 ProductList
 Product
 SupplierCode001982/SupplierCode
 SegmentId6500/SegmentId
 GroupId6501/GroupId
 ClassId65010200/ClassId
 SeriesId10001125/SeriesId
 VendorIdAM/VendorId
 PartNumberADA3000BIBOX/PartNumber
 NameAMD Athlon64 3000+ (1800MHz/L2 Cache 512KB) Socket 939, BOX/Name
 Warranty36/Warranty
 Price196.0/Price
 Quantity0/Quantity
 DateExpected1999-01-01T00:00:00/DateExpected
 IsNewProducttrue/IsNewProduct
 /Product
 Product
 SupplierCode001512/SupplierCode
 SegmentId6500/SegmentId
 GroupId6501/GroupId
 ClassId65010200/ClassId
 SeriesId10001125/SeriesId
 VendorIdAM/VendorId
 Acme API Specification v 1.0
 13
 PartNumberADA3000AXBOX/PartNumber
 NameAMD Athlon64 3000+ (2000MHz/1600MHz/L2 Cache 512KB) Socket 754,
 BOX/Name
 Warranty36/Warranty
 Price296.0/Price
 Quantity0/Quantity
 GrossWeight3.6000/GrossWeight
 DateExpected1999-01-01T00:00:00/DateExpected
 IsNewProductfalse/IsNewProduct
 /Product
 /ProductList
 /GetProductListResult
 /GetProductListResponse
 /soap12:Body
 /soap12:Envelope



 --
 Regards

Re: [GENERAL] Why PGSQL has no developments in the .NET area?

2011-10-03 Thread Francisco Figueiredo Jr.
Hi!

What usage case of Npgsql are you having performance issues?


On Sun, Oct 2, 2011 at 00:32, Rohit Coder
passionate_program...@hotmail.com wrote:
 PgSQL has just one old NPGSQL driver for .NET, which is itself sluggish. The
 ODBC driver works better as compared to NPGSQL, but I suspect the ODBC
 driver is not the right choice for ORM framework of .NET.

 I want to know whether there is any efficient .NET provider and is PGSQL
 compatible with the .NET entity framework.

 Regards,
 Rohit.




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Why PGSQL has no developments in the .NET area?

2011-10-03 Thread Francisco Figueiredo Jr.
On Mon, Oct 3, 2011 at 13:46, Chris Travers chris.trav...@gmail.com wrote:



 On Mon, Oct 3, 2011 at 9:13 AM, mgo...@isstrucksoftware.net wrote:

  The Ngpsql driver isn't old.  They've released updates to it all through
 version 8 and 9 so far as I know.  We do some .Net work against Postgres and
 it seems to work for what we're doing.

 Indeed, the latest release seems to be less than a month old.  It does
 seem the project could release news items more frequently though. ;-)

 Best Wishes,
 Chris Travers




Yeah, I agree with you. Sorry for that.

On the good side, we released a new beta last week. :)


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior
top.letterhead

[GENERAL] Pgfoundry problem with Npgsql bug tracker

2011-06-24 Thread Francisco Figueiredo Jr.
Hi all!

Sorry for sending this message here, but I couldn't find a better
place after asking in the pgfoundry support forum and not receive any
answer. As it is full of spam, I don't know if it is being read very
often.

Here is my problem:

when I access Npgsql bugs tracker, I get the following error:

Error

Database Error: ERROR: could not open relation artifact_message: No
such file or directory


I thought it was a general problem with pgfoundry, but other projects
I picked up at random don't have this problem when accessing their
respective bugs tracker.

This situation is like this for a week. In the past we had some
problems which didn't last more than a day, so I think this may be
something else.

Would you mind to get in touch with the person who could check that
for me, or ask him/her to send me a reply?

We are having problems to submit new bug reports and checking the
status of current bugs.

Thanks in advance and again, sorry for bothering you in this list.

-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Npgsql 2.0.12 beta1 released!

2011-03-24 Thread Francisco Figueiredo Jr.
Hi, all!!

The Npgsql Development Team is proud to announce the Npgsql2 2.0.12
beta1 release!

Npgsql is a .Net Data provider written 100% in C# which allows .net
programs to talk to postgresql backends. Npgsql is licensed under BSD.
More info can be obtained from http://www.npgsql.org

Thsi is the release notes:


Npgsql 2.0.12 beta1 (2.0.11.91)


Important Notice:

This is a beta release intended to test some critical fixes
added since last stable release.
Special attention should be given to connection pool
interactions. We improved connection pool of Npgsql. Previous
implementation was letting connections to be leaked. Now this
implementation keeps a reference to all the connections and keeps
better track of them. We also improved connection validation from pool
before delivering it to the user. This may fix problems where users
were reporting strange data from new connections.
Another attention should be paid to Dataset and DataAdapter
operations. We changed some internals of NpgsqlCommandBuilder which
may cause problems. We'd like you to check if you get problems. For
more information check this thread:
http://pgfoundry.org/tracker/?func=detailatid=590aid=1010973group_id=1000140


Fixed bugs:

[#1010951] AllowPartiallyTrustedCallers for npgsql assemblies.
[#1010973] specified cast is invalid - datetime fields. In
order to fix this bug I had to disable some code in
NpgsqlCommandBuilder. Watch out for possible side effects.
Fixed problems with SSPI authentication when the password had
some non ascii characteres. Also, Npgsql supports to authenticate with
an user name other than the current logged one. Thanks Ahmed Shinwari
for tests and patch.
[#1010997] Consider using System.Threading.Timer instead of
System.Timers.Timer. Thanks Alex A Ermoshenko for feedback, patch and
tests.
NpgsqlConnector.CancelRequest leaks Connector.
NpgsqlConnector.CancelRequest creates a connector to cancel the
running request, but does not close it. More info at:
http://pgfoundry.org/forum/forum.php?thread_id=10059forum_id=519
Thanks David Leaver for patch.
Exception when closing connection. If your connection is in
the Ready state and the stream is actually broken
NpgsqlReadyState.Close will throw an exception when trying to write to
the stream. More info can be found at:
http://pgfoundry.org/forum/forum.php?thread_id=10066forum_id=519
Thanks David Leaver for the patch.
In Multi-threaded applications there is a race condition that 
can
occur which will result in a broken connection being re-added to the
pool. Thanks David Leaver for patches. More information here:
http://pgfoundry.org/forum/forum.php?thread_id=10067forum_id=519
[#1010986] Endless recursion on hanging connection in
ProcessBackendResponsesEnum. Thanks Gildas for feedback and tests.

Enhancements:

   Added performance patch to GetKeyName method. Thanks Dan Smith for
patch. 
http://lists.pgfoundry.org/pipermail/npgsql-devel/2011-February/001117.html




You can see full changelog and release notes here:
http://pgfoundry.org/frs/shownotes.php?release_id=1727


You can dowload it from here: http://downloads.npgsql.org

Thank you to Josh Cooley for all his help with entity framework support!

Thank you to all who sent feedbacks, suggestions and patches.
You helped to make this release.

Thank you very much to David Leaver who gave a lot of feedback and
patches to improve connection pool.

Please, give it a try and feel free to let us know if you find any problem.



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Re: [GENERAL] Re: [GENERAL] Re: [GENERAL] Different encoding for string values and identifier strings? Or (select 'tést' as tést) returns different values for string and identifier...

2011-03-18 Thread Francisco Figueiredo Jr.
Oh, sorry for that.

My client code is Npgsql. I pulled those bytes from a debugging session
directly from the network stream. I wanted to know what bytes npgsql was
receiving.

This is the method which reads the data:

public static String ReadString(Stream network_stream)
{
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, ReadString);

Listbyte buffer = new Listbyte();
for (int bRead = network_stream.ReadByte(); bRead != 0; bRead =
network_stream.ReadByte())
{
if (bRead == -1)
{
throw new IOException();
}
else
{
buffer.Add((byte) bRead);
}
}

if (NpgsqlEventLog.Level = LogLevel.Debug)
NpgsqlEventLog.LogMsg(resman, Log_StringRead,
LogLevel.Debug, ENCODING_UTF8.GetString(buffer.ToArray()));

return ENCODING_UTF8.GetString(buffer.ToArray());
}

My database has encoding set to UTF-8 although my lc_collate is pt.BR.UTF-8
this lc setting my have cause some trouble?

I also have problems with psql client where the char doesn't appear at all.
Andreas could see the char though...

I hope it helps.

Thanks in advance.
--
Sent from my Android phone

Francisco Figueiredo Jr.
Npgsql lead developer
fxjr.blogspot.com
twitter.com/franciscojunior
Em 18/03/2011 01:29, Tom Lane t...@sss.pgh.pa.us escreveu:


[GENERAL] Re: [GENERAL] Re: [GENERAL] Re: [GENERAL] Re: [GENERAL] Different encoding for string values and identifier strings? Or (select 'tést' as tést) returns different values for string and identi

2011-03-18 Thread Francisco Figueiredo Jr.
Hm,

I'm using osx 10.6.6 and I compiled PG myself from source. Is there any
configure option or any library I may use to get the correct behavior? Is
there any runtime setting I can make to change this tolower() behavior,
maybe skip the call?

Thanks in advance.

--
Sent from my Android phone

Francisco Figueiredo Jr.
Npgsql lead developer
fxjr.blogspot.com
twitter.com/franciscojunior
Em 18/03/2011 22:01, Tom Lane t...@sss.pgh.pa.us escreveu:
 Francisco Figueiredo Jr. franci...@npgsql.org writes:
 My database has encoding set to UTF-8 although my lc_collate is
pt.BR.UTF-8
 this lc setting my have cause some trouble?

 Hmmm ... actually, it strikes me that this may be a downcasing problem.
 PG will try to feed an unquoted identifier through tolower(), and that
 basically can't work on multibyte characters. Most implementations of
 tolower() are smart enough to not change high-bit-set bytes in UTF8
 locales, but maybe your platform's is not ...

 regards, tom lane


[GENERAL] Re: [GENERAL] Re: [GENERAL] Different encoding for string values and identifier strings? Or (select 'tést' as tést) returns different values for string and identifier...

2011-03-17 Thread Francisco Figueiredo Jr.
Any ideas??

Would it be possible that Postgresql would be using another encoding
for the identifiers when they aren't wrapped by double quotes?


On Tue, Mar 15, 2011 at 23:37, Francisco Figueiredo Jr.
franci...@npgsql.org wrote:
 Now, I'm using my dev machine.

 With the tests I'm doing, I can see the following:

 If I use:

 select 'seléct' as seléct;

 column name returns ok as expected.

 If I do:

 select 'seléct' as seléct;


 This is the sequence of bytes I receive from postgresql:

 byte1 - 115 UTF-8 for s
 byte2 - 101 UTF-8 for e
 byte3 - 108 UTF-8 for l
 byte4 - 227
 byte5 - 169
 byte6 - 99 UTF-8 for c
 byte7 - 116 UTF-8 for t


 The problem lies in the byte4.
 According to [1], the first byte defines how many bytes will compose
 the UTF-8 char. the problem is that 227 encodes to a binary value of
 1110 0011 and so, the UTF-8 decoder will think there are 3 bytes in
 sequence when actually there are only 2! :( And this seems to be the
 root of the problem for me.


 For the select value the correct byte is returned:

 byte1 - 115 UTF-8 for s
 byte2 - 101 UTF-8 for e
 byte3 - 108 UTF-8 for l
 byte4 - 195
 byte5 - 169
 byte6 - 99 UTF-8 for c
 byte7 - 116 UTF-8 for t


 Where 195 is 1100 0011 which gives two bytes in sequence and the
 decoder can decode this to the U+00E9 which is the char é

 Do you think this can be related to my machine? I'm using OSX 10.6.6
 and I compiled postgresql 9.0.1 from source code.

 Thanks in advance.




 [1] - http://en.wikipedia.org/wiki/UTF-8




 On Tue, Mar 15, 2011 at 15:52, Francisco Figueiredo Jr.
 franci...@npgsql.org wrote:
 H,

 What would change the encoding of the identifiers?

 Because on my dev machine which unfortunately isn't with me right now
 I can't get the identifier returned correctly :(

 I remember that it returns:

  test=*# select 'tést' as tést;
   tst
  --
   tést

 Is there any config I can change at runtime in order to have it
 returned correctly?

 Thanks in advance.


 On Tue, Mar 15, 2011 at 15:45, Andreas Kretschmer
 akretsch...@spamfence.net wrote:
 Francisco Figueiredo Jr. franci...@npgsql.org wrote:


 What happens if you remove the double quotes in the column name identifier?

 the same:

 test=*# select 'tést' as tést;
  tést
 --
  tést
 (1 Zeile)



 Andreas
 --
 Really, I'm not out to destroy Microsoft. That will just be a completely
 unintentional side effect.                              (Linus Torvalds)
 If I was god, I would recompile penguin with --enable-fly.   (unknown)
 Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




 --
 Regards,

 Francisco Figueiredo Jr.
 Npgsql Lead Developer
 http://www.npgsql.org
 http://fxjr.blogspot.com
 http://twitter.com/franciscojunior




 --
 Regards,

 Francisco Figueiredo Jr.
 Npgsql Lead Developer
 http://www.npgsql.org
 http://fxjr.blogspot.com
 http://twitter.com/franciscojunior




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Different encoding for string values and identifier strings? Or (select 'tést' as tést) returns different values for string and identifier...

2011-03-15 Thread Francisco Figueiredo Jr.
Hi all!

I received a bug report about problems with identifiers.

If I do the following select:

select 1 as tést

The column name returned contains strange chars.

If I do:

select 'tést' as tést

the select value returned is ok but the column name is not. :(

Is there any configuration I need to change to specify the encoding of
the identifiers?

I'm using UTF-8 for my database.

Thanks in advance.


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Re: [GENERAL] Different encoding for string values and identifier strings? Or (select 'tést' as tést) returns different values for string and identifier...

2011-03-15 Thread Francisco Figueiredo Jr.
This is the query our user sent as one of the problems:

select zurück as zurück3_103_ from Tabelle tabellenhib0_

And here is the link to our bug report:

http://pgfoundry.org/tracker/index.php?func=detailaid=1010988group_id=1000140atid=590


I didn't test putting double quotes in the column name identifier as
the bug report isn't using it.

What happens if you remove the double quotes in the column name identifier?

Thanks in advance.



On Tue, Mar 15, 2011 at 15:21, Andreas Kretschmer
akretsch...@spamfence.net wrote:
 Francisco Figueiredo Jr. franci...@npgsql.org wrote:

 Hi all!

 I received a bug report about problems with identifiers.

 If I do the following select:

 select 1 as tést

 The column name returned contains strange chars.

 If I do:

 select 'tést' as tést

 the select value returned is ok but the column name is not. :(

 Is there any configuration I need to change to specify the encoding of
 the identifiers?

 test=# select 'tést' as tést;
  tést
 --
  tést

 looks okay for me ...


 Andreas
 --
 Really, I'm not out to destroy Microsoft. That will just be a completely
 unintentional side effect.                              (Linus Torvalds)
 If I was god, I would recompile penguin with --enable-fly.   (unknown)
 Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Re: [GENERAL] Re: [GENERAL] Different encoding for string values and identifier strings? Or (select 'tést' as tést) returns different values for string and identifier...

2011-03-15 Thread Francisco Figueiredo Jr.
H,

What would change the encoding of the identifiers?

Because on my dev machine which unfortunately isn't with me right now
I can't get the identifier returned correctly :(

I remember that it returns:

 test=*# select 'tést' as tést;
  tst
 --
  tést

Is there any config I can change at runtime in order to have it
returned correctly?

Thanks in advance.


On Tue, Mar 15, 2011 at 15:45, Andreas Kretschmer
akretsch...@spamfence.net wrote:
 Francisco Figueiredo Jr. franci...@npgsql.org wrote:


 What happens if you remove the double quotes in the column name identifier?

 the same:

 test=*# select 'tést' as tést;
  tést
 --
  tést
 (1 Zeile)



 Andreas
 --
 Really, I'm not out to destroy Microsoft. That will just be a completely
 unintentional side effect.                              (Linus Torvalds)
 If I was god, I would recompile penguin with --enable-fly.   (unknown)
 Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Re: [GENERAL] Re: [GENERAL] Different encoding for string values and identifier strings? Or (select 'tést' as tést) returns different values for string and identifier...

2011-03-15 Thread Francisco Figueiredo Jr.
Now, I'm using my dev machine.

With the tests I'm doing, I can see the following:

If I use:

select 'seléct' as seléct;

column name returns ok as expected.

If I do:

select 'seléct' as seléct;


This is the sequence of bytes I receive from postgresql:

byte1 - 115 UTF-8 for s
byte2 - 101 UTF-8 for e
byte3 - 108 UTF-8 for l
byte4 - 227
byte5 - 169
byte6 - 99 UTF-8 for c
byte7 - 116 UTF-8 for t


The problem lies in the byte4.
According to [1], the first byte defines how many bytes will compose
the UTF-8 char. the problem is that 227 encodes to a binary value of
1110 0011 and so, the UTF-8 decoder will think there are 3 bytes in
sequence when actually there are only 2! :( And this seems to be the
root of the problem for me.


For the select value the correct byte is returned:

byte1 - 115 UTF-8 for s
byte2 - 101 UTF-8 for e
byte3 - 108 UTF-8 for l
byte4 - 195
byte5 - 169
byte6 - 99 UTF-8 for c
byte7 - 116 UTF-8 for t


Where 195 is 1100 0011 which gives two bytes in sequence and the
decoder can decode this to the U+00E9 which is the char é

Do you think this can be related to my machine? I'm using OSX 10.6.6
and I compiled postgresql 9.0.1 from source code.

Thanks in advance.




[1] - http://en.wikipedia.org/wiki/UTF-8




On Tue, Mar 15, 2011 at 15:52, Francisco Figueiredo Jr.
franci...@npgsql.org wrote:
 H,

 What would change the encoding of the identifiers?

 Because on my dev machine which unfortunately isn't with me right now
 I can't get the identifier returned correctly :(

 I remember that it returns:

  test=*# select 'tést' as tést;
   tst
  --
   tést

 Is there any config I can change at runtime in order to have it
 returned correctly?

 Thanks in advance.


 On Tue, Mar 15, 2011 at 15:45, Andreas Kretschmer
 akretsch...@spamfence.net wrote:
 Francisco Figueiredo Jr. franci...@npgsql.org wrote:


 What happens if you remove the double quotes in the column name identifier?

 the same:

 test=*# select 'tést' as tést;
  tést
 --
  tést
 (1 Zeile)



 Andreas
 --
 Really, I'm not out to destroy Microsoft. That will just be a completely
 unintentional side effect.                              (Linus Torvalds)
 If I was god, I would recompile penguin with --enable-fly.   (unknown)
 Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




 --
 Regards,

 Francisco Figueiredo Jr.
 Npgsql Lead Developer
 http://www.npgsql.org
 http://fxjr.blogspot.com
 http://twitter.com/franciscojunior




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] could not accept SSPI security context

2011-03-10 Thread Francisco Figueiredo Jr.
That's great!

I'm glad to hear it.

Thank you very much for providing patches for this issue.

--
Sent from my Android phone

Francisco Figueiredo Jr.
Npgsql lead developer
fxjr.blogspot.com
twitter.com/franciscojunior
Em 10/03/2011 09:01, Ahmed Shinwari ahmed.shinw...@gmail.com escreveu:
 Hi Fransisco,

 I tested the latest Npgsql driver (2.0.12.0), the issue has been fixed. I
 was able to connect Npgsql test application from my Windows XP client
 machine with the PostgreSQL server running on Windows 2003 Server.

 Thank you for applying the patch.


 On Thu, Feb 24, 2011 at 3:37 PM, Ahmed Shinwari ahmed.shinw...@gmail.com
wrote:



 On Sat, Feb 19, 2011 at 11:31 PM, Brar Piening b...@gmx.de wrote:

 On Thu, 17 Feb 2011 07:58:46 -0800 (PST), Ahmed 
ahmed.shinw...@gmail.com
 wrote:

 I tried changing that one line to use UTF-8 encoder, but the password
 packet
 didn't get fixed. It works smoothly if kept in byte array instead of
 string.

 Yes, as SSPI uses binary bytes we have to avoid to convert them to
 characters and back to bytes during message generation.

 While char *buffer in C can serve as both a string and a buffer of
 binary bytes, we have byte[] as binary buffer and string as string
in
 c#.
 This is the reason why we need to use byte[] in all places where libpq
 uses char* without really caring whether there is a string inside or
some
 opaque bytes.


 I think changing the AuthenticationSSPI case to use context.Host may
 break
 the cases Brar's mentioned.

 If this isn't necessary to fix the problem we should probably get some
 more instight to what really happens here before fixing one end and
breaking
 the other.

 I agree.


 For now, Francisco may check in that part which fixes the bug due to
 encoding. And, address the later issue after further investigation.




 Regards,

 Brar





Re: [GENERAL] unexpected EOF on client connection vs 9.0.3

2011-03-08 Thread Francisco Figueiredo Jr.
Indeed those messages appear when the client closes the socket connection only.

Npgsql has connection pooling and if the app domain is unloaded and
there are connections in the pool, those connections don't get a
chance to have the Close message sent to backend server.

So, even when you are correctly closing your connection, you still
will see those messages.

You can prevent that from appearing by disabling the connection
pooling. Which I advise against.

Also, you may want to check if your domain app is being unloaded for
some reason.

I never see any harm being done because the connection exited without
sending the close message. So I think you could (safely?) ignore this
message on this case.

I hope it helps.


On Tue, Mar 8, 2011 at 05:50, rsmogura rsmog...@softperience.eu wrote:
 On Tue, 08 Mar 2011 11:30:10 +0800, Craig Ringer wrote:

 On 08/03/11 02:49, Piotr Czekalski wrote:

 I've checked and verified that all connections are closed within the
 code, what's more, the problem has appeared just as I've moved server
 from Fedora Linux x86_64 running Postgres 8.4.2 to the Windows and 9.0.3
 (details above) thus I conclude this is not a client problem indeed (the
 failure didn't occure on Linux).

 Windows firewall?

 You can also see these error reports when the connections are closed
 uncleanly, without a proper backend close message. Perhaps you have
 client processes crashing? Or doing hard shutdowns where the client code
 doesn't get a chance to run any cleanup/dtors/etc?

 --
 Craig Ringer

 I think in 8.x releases is no need to make any spacial close operation, or
 at least You do not get notice, about it. Closing socket is enough. E.g.
 JDBC driver closes connection, by closing socket. In 9 this changed and I
 see many of such notices in log. Probably Your driver, as many others, is
 written to close socket without backanad message.

 Regards,
 Radek

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] could not accept SSPI security context

2011-02-06 Thread Francisco Figueiredo Jr.
Hi, Ahmed!

Thanks for checking this problem.

It is really a bug in Npgsql to convert the bytes value with ASCII encoder.

If we change that line to use the UTF-8 encoder, wouldn't it suffice
to fix this problem?

Also, wouldn't change the AuthenticationSSPI case to use context.Host
instead of Brar's code wouldn't break cases like the one he said in
his last email?

Thanks for feedback.


On Wed, Feb 2, 2011 at 14:11, Francisco Figueiredo Jr.
franci...@npgsql.org wrote:
 Thank you very much for your patch!

 I'm going to review and apply it.

 As soon as it is done, I'll let you know.


 On Wed, Feb 2, 2011 at 12:52, Ahmed ahmed.shinw...@gmail.com wrote:

 The issue has been addressed and patch has been submitted. Refer to Npgsql
 mailing thread
 http://lists.pgfoundry.org/pipermail/npgsql-devel/2011-February/001116.html
 http://lists.pgfoundry.org/pipermail/npgsql-devel/2011-February/001116.html
 .

 --
 View this message in context: 
 http://postgresql.1045698.n5.nabble.com/could-not-accept-SSPI-security-context-tp3275102p3367884.html
 Sent from the PostgreSQL - general mailing list archive at Nabble.com.

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




 --
 Regards,

 Francisco Figueiredo Jr.
 Npgsql Lead Developer
 http://www.npgsql.org
 http://fxjr.blogspot.com
 http://twitter.com/franciscojunior




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] could not accept SSPI security context

2011-02-02 Thread Francisco Figueiredo Jr.
Thank you very much for your patch!

I'm going to review and apply it.

As soon as it is done, I'll let you know.


On Wed, Feb 2, 2011 at 12:52, Ahmed ahmed.shinw...@gmail.com wrote:

 The issue has been addressed and patch has been submitted. Refer to Npgsql
 mailing thread
 http://lists.pgfoundry.org/pipermail/npgsql-devel/2011-February/001116.html
 http://lists.pgfoundry.org/pipermail/npgsql-devel/2011-February/001116.html
 .

 --
 View this message in context: 
 http://postgresql.1045698.n5.nabble.com/could-not-accept-SSPI-security-context-tp3275102p3367884.html
 Sent from the PostgreSQL - general mailing list archive at Nabble.com.

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Read problem from Bytea column

2011-01-22 Thread Francisco Figueiredo Jr.
Francisco Figueiredo Jr

Sent from my Android phone.

Em 21/01/2011 13:50, orgilhp orgi...@gmail.com escreveu:

 Hello,

Hello!

 I have postgresql 8.3.9 database. Now I am working on reading file
 from bytea data and save to filesystem.
 I am using Npgsql.dll on c#.net.


Which version of Npgsql are you using?

Your code is ok and should be working. More info can be get from Working
with binary data and bytea datatype section of npgsql user manual.

Did you try another npgsql version? If it works in another version, please,
fill a bug report so we can fix it.

Thanks in advance!

 First I have using OpenERP to upload a file to postgres database in
 bytea column. The original file size is 104,960 bytes and .doc
 extension.
 Then I read the bytea data and save it to file system, its size
 becomes 141,790 bytes. This file cannot be opened however its
 extension is .doc.

 What is going on?

 My c# code is below:

 NpgsqlCommand cmd = new NpgsqlCommand(SELECT bytea_col
 FROM TableTest LIMIT 1, Conn);
 using (FileStream stream = new FileStream(c:\test.doc,
 FileMode.Create))
{
byte[] rawbytes = (byte[])cmd.ExecuteScalar();
stream.Write(rawbytes, 0, rawbytes.Length);
stream.Close();
}

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Bytea error in PostgreSQL 9.0

2010-12-14 Thread Francisco Figueiredo Jr.
Latest Npgsql version 2.0.11 already has a fix to handle new bytea
representation.

Can you try with this version and see if it works ok?

I hope it helps.

On Tue, Dec 14, 2010 at 14:22, tuanhoanganh hatua...@gmail.com wrote:
 Thanks for your answer. But I don't want to change db config or ALTER
 DATABASE data SET bytea_output='escape';
 I can change my app. So is there document introduce how to work with
 postgresql 9 bytea ( I don't want to user lo_create, lo_import. lo_export)

 Tuan Hoang Anh

 On Tue, Dec 14, 2010 at 8:55 PM, Ivan Voras ivo...@freebsd.org wrote:

 On 14/12/2010 14:51, tuanhoanganh wrote:

 Thanks for your help.
 Is there any .Net or VB tutorial new 9.0 bytea?

 You do not need to change your code if you add

 bytea_output = 'escape'                 # hex, escape

 into postgresql.conf.



 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general





-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Access postgresql data base from .net

2010-11-05 Thread Francisco Figueiredo Jr.
We've made changes to support @ parameter prefix exactly to easy
porting of sqlserver client queries to postgresql. This way you may
need minimum changes to your code. Just to those specific sql calls.


On Fri, Nov 5, 2010 at 19:40, mike stanton mike.stan...@autocastillo.cl wrote:

 Dann, perhaps the a better question would be.if we use, for example,
 npgsql, we'd have to adapt code and use the tools own calls. And that means
 rewriting. Is this true?.

 Cheers
 Mike

 - Original Message -
 From: Dann Corbit
 To: 'mike stanton' ; pgsql-general@postgresql.org
 Cc: mike stanton
 Sent: Friday, November 05, 2010 5:12 PM
 Subject: Re: [GENERAL] Access postgresql data base from .net

 From: pgsql-general-ow...@postgresql.org
 [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of mike stanton
 Sent: Friday, November 05, 2010 12:08 PM
 To: pgsql-general@postgresql.org
 Cc: mike stanton
 Subject: [GENERAL] Access postgresql data base from .net



 Hello all; we´ve got a project where we have a system built originally for
 .net/sql-server. Now we want to change sql-server for a postgresql database.
 And preferably without using the ODBC driver which we have heard is prone to
 errors.



 What specific errors did you hear about?

 I suggest testing the rumors.  If there really is some problem, then submit
 a bug report.

 Sometimes, people want you to use their tools, and so they will exaggerate
 the problem with competitive tools.

 



 Is there a producto which we can use which does not imply a major rewrite of
 all the SQL ?.



 Probably most interface tools will work if you are using ISO standard SQL.
 Any place where you are using SQL language extensions you will have to do
 some work.

 You can find interfaces here:

 http://pgfoundry.org/softwaremap/trove_list.php?form_cat=310



 There are also a very large number of commercial interfaces for PostgreSQL
 available. You can find out about those here:

 http://www.sqlsummit.com/DataAcce.htm

 



 Obviously we may have problemas with differences between Sql-server and
 Postgresql syntax, but we don´t want to de a rewrite.



 What specific problems are you having?

 



 Hope to hear soon, any help appreciated.



 Mike Stanton W.
 Santiago Chile

 __ Información de ESET NOD32 Antivirus, versión de la base de firmas
 de virus 5575 (20101029) __

 ESET NOD32 Antivirus ha comprobado este mensaje.

 http://www.eset.com

 __ Información de ESET NOD32 Antivirus, versión de la base de firmas
 de virus 5575 (20101029) __

 ESET NOD32 Antivirus ha comprobado este mensaje.

 http://www.eset.com




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Windows 2008/IIS cannot connect to Postgres 9.0

2010-10-24 Thread Francisco Figueiredo Jr.
On Thu, Oct 7, 2010 at 00:00, Craig Ringer cr...@postnewspapers.com.au wrote:
 On 05/10/10 16:08, Mike Christensen wrote:

    at Npgsql.NpgsqlCommand.CheckConnectionState() at
 Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb) at

 It looks like nobody reading -GENERAL really speaks npgsql/.NET/C#.
 Perhaps you should try on the npgsql list instead?


I do. Although I sometimes take more time than normal to answer...
Sorry for that.

Well, the error you are getting is really because Npgsql isn't being
able to connect to your postgresql server.

I also have no idea about what Managed Pipeline means but I'm glad you
get it working.

Would you mind to share how did you set it up so we can share that
with other Postgresql/Npgsql users?



 Try filing a bug/support request here:

 http://pgfoundry.org/projects/npgsql/

 or posting in the forums linked to off that page. It looks like the
 npgsql folks primarily use forums and the tracker for user support.


Yeap. That's our primary support way.

But I also keep eye on general, dev and interfaces mailing list in
case something about Npgsql appears.



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Npgsql Exception

2010-08-23 Thread Francisco Figueiredo Jr.
Are you using Npgsql with NHibernate?

We added an option to send this command when starting a connection.

But the setting is inside a try catch error handler, so you aren't
supposed to receive it.

On my tests I couldn't reproduce the error. The only error we got
about that was a user who had a breakpoint set in VS.net to trigger an
exception whenever there was an error from server. But this was only
while debugging his app, obviously.


On Mon, Aug 23, 2010 at 10:49, Tom Lane t...@sss.pgh.pa.us wrote:
 Mike Christensen m...@kitchenpc.com writes:
 Sorry, when I had emailed the NHibernate DL the exception was in the
 subject line.  I forgot to copy the subject this time.  The exception
 is:

 ERROR: 42704: unrecognized configuration parameter
 ssl_renegotiation_limit

 ssl_renegotiation_limit is a server parameter that was added to all
 active PG branches in a security patch last February.  Apparently you
 have a postgresql.conf file that tries to set that parameter, and have
 reverted to a server version that doesn't include it.  Best fix is to
 update your PG to latest minor release.  Alternatively you could take
 out the setting but that would imply you don't have the security fix,
 and also probably the problem that led you to put in the setting would
 come back.

                        regards, tom lane

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Npgsql Exception

2010-08-23 Thread Francisco Figueiredo Jr.
Whooops,

I didn't check the message header...

You can ignore my first question :)

On Mon, Aug 23, 2010 at 15:56, Francisco Figueiredo Jr.
franci...@npgsql.org wrote:
 Are you using Npgsql with NHibernate?

 We added an option to send this command when starting a connection.

 But the setting is inside a try catch error handler, so you aren't
 supposed to receive it.

 On my tests I couldn't reproduce the error. The only error we got
 about that was a user who had a breakpoint set in VS.net to trigger an
 exception whenever there was an error from server. But this was only
 while debugging his app, obviously.


 On Mon, Aug 23, 2010 at 10:49, Tom Lane t...@sss.pgh.pa.us wrote:
 Mike Christensen m...@kitchenpc.com writes:
 Sorry, when I had emailed the NHibernate DL the exception was in the
 subject line.  I forgot to copy the subject this time.  The exception
 is:

 ERROR: 42704: unrecognized configuration parameter
 ssl_renegotiation_limit

 ssl_renegotiation_limit is a server parameter that was added to all
 active PG branches in a security patch last February.  Apparently you
 have a postgresql.conf file that tries to set that parameter, and have
 reverted to a server version that doesn't include it.  Best fix is to
 update your PG to latest minor release.  Alternatively you could take
 out the setting but that would imply you don't have the security fix,
 and also probably the problem that led you to put in the setting would
 come back.

                        regards, tom lane

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




 --
 Regards,

 Francisco Figueiredo Jr.
 Npgsql Lead Developer
 http://www.npgsql.org
 http://fxjr.blogspot.com
 http://twitter.com/franciscojunior




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Working with pages of data (LIMIT/OFFSET keyword)

2010-06-17 Thread Francisco Figueiredo Jr.
I would go with 2).

Npgsql supports multiple resultsets. You can pass a query separated by
semicolon ';'  or you can use a procedure call which return a setof
refcursor.

On both ways, you will need to call NextResult in your Datareader just
like with SQLServer.

You can check our user manual: http://manual.npgsql.org to get more
info about how to use refcursors

I hope it helps.

Please, let me know if you need more info.



On Wed, Jun 16, 2010 at 16:44, Szymon Guz mabew...@gmail.com wrote:


 2010/6/16 Mike Christensen m...@kitchenpc.com

 I'm generating a query on the fly to return a set of data, however I
 only want to display 30 rows at a time to the user.  For this reason,
 I use the LIMIT 30 OFFSET x clause on the select statement.  However,
 I also want to know the total rows that match this query had there
 been no limit, that way I can display to the user the total count and
 the number of pages, and have Next/Prev buttons in my UI.  I can think
 of the following ways to do this:

 1) When the page loads, execute two totally separate queries.  One
 that does the COUNT, and then another query immediately after to get
 the desired page of data.  I don't like this as much because the two
 queries will execute in separate transactions and it'd be nice if I
 could just perform a single SQL query and get all this information at
 once.  However, I will use this if there's no other way.


 Just run them in one transaction.
 You can also just show the Next/Prev buttons and then do something just for
 the case where there is no data.
 Or use LIMIT 31 so you always know that there is the next page with at least
 one record.
 regards
 Szymon Guz



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Does npgsql have a bunch of bugs with DB enums?

2010-06-08 Thread Francisco Figueiredo Jr.
Thank you very much, Mike!

We'll have a look at that.


On Tue, Jun 8, 2010 at 00:03, Mike Christensen m...@kitchenpc.com wrote:
 Ok I did more investigation on this and traced the issue down to a
 singe npgsql bug.  Enums actually work fine, as long as you're using
 an IDataReader to get at the data.  Once you attempt to load the
 reader into a DataSet, it blows up.  I'll log this bug..

 Mike

 On Mon, Jun 7, 2010 at 4:43 AM, Mike Christensen m...@kitchenpc.com wrote:
 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


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general




-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Npgsql connection string editor?

2010-02-24 Thread Francisco Figueiredo Jr.
Hi!

This code is for initial design time support on VS.net 2003.

We are still working to get vs.net 2005 design time support as the
code to support it changed completely.

Sorry for this confusion. I'll check the docs to clarify this.


On Tue, Feb 23, 2010 at 17:00, Radcon Entec radconen...@yahoo.com wrote:
 Greetings!

 I have found references on the Internet to a connection string designer for
 npgsql, but I haven't found where to get it.  I don't seem to have it with
 my download of npgsq. Or am I just looking in the wrong place?

 For example, http://npgsql.projects.postgresql.org/exampleprograms.html ,
 which is from the main npgsql web site, contains the following:

 public void ConnectToData()
 {
 string DSN;
 Npgsql.Design.ConnectionStringEditorForm Ndesign = new
 Npgsql.Design.ConnectionStringEditorForm();
 Ndesign.ShowDialog();
 DSN = Ndesign.ConnectionString.ToString();
 if (DSN == )
 return;

 conn = new NpgsqlConnection(DSN);
 dset = new DataSet(npdata);
 NpAdapter = new NpgsqlDataAdapter();
 NpAdapter.SelectCommand = new NpgsqlCommand(query, conn);
 NpAdapter.Fill(dset, npdata);
 dtsource = dset.Tables[npdata];

 deleteCmd();
 updateCmd();
 insertCmd();
 }

 How can I get ConnectionStringEditorForm?

 RobR






-- 
Regards,

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

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Unexpected EOF on client connection

2009-12-01 Thread Francisco Figueiredo Jr.
On Tue, Dec 1, 2009 at 13:52, Howard Cole howardn...@selestial.com wrote:
 I am getting many entries in my log of this type:

 2009-12-01 00:13:19 GMTLOG: unexpected EOF on client connection
 2009-12-01 00:13:19 GMTLOG could not receive data from client: No connection
 could be made because the target machine actively refused it.

 I tend to get these message in batches of 2 to 8 - checking the number of
 connections at the time, they do not appear to be overloaded.

 I am running 8.4.1 on Windows 2K3 with a C# application using Npgsql. All
 connections are to the localhost and there is no firewall.



Maybe this is Npgsql removing connections from pool after some time.
But it may not be this case because Npgsql finishes the connection
correctly when removing it from the pool.

You can confirm that by playing with your max connection pool and min
connection pool values in your connection string. Try to put a higher
value of min connection pool, so they aren't closed too frequently.


Also, as Richard said, check your connection usage pattern in your application.

I hope it helps.





-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Unexpected EOF on client connection

2009-12-01 Thread Francisco Figueiredo Jr.
On Tue, Dec 1, 2009 at 21:39, Howard Cole howardn...@selestial.com wrote:
 Howard Cole wrote:

 Interesting what Francis says about the pool connections being closed
 before disposal.

 Apologies Francisco


:) No problem.


 Presumably I should never get this error if I use Npgsql?


That's correct. But there may be a bug in Npgsql code itself.
That's why I asked you to try to raise minpoolvalue to check if you
see less errors.

I hope it helps.


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Behavior of NpgsqlDataReader in NpgSql 1 and NpgSql 2

2009-06-12 Thread Francisco Figueiredo Jr.
On Fri, Jun 12, 2009 at 07:35, Nishkarshnishkars...@rediffmail.com wrote:

 Hello every one,

Hello, Nishkarsh!

 I have a Vb 2005 application with postgres 8.2 as DB.

 I was trying to move from Pg 8.2 to 8.3.7, the installation went well. Once
 i tried running my application i got some errors. After doing some research
 i realized that.

 - NpgsqlDataReader in NpgSql 1 was capable to retain the records even eve
 after the connection is closed but it is not happening with NpgSql 2

 After doing a bit of googleing i was not able to find any info on it.

 Can any one plz tel me that is it the case or i have to do some modification
 in the code. If that is the case then is there any other object which can be
 used the way i was using NpgsqlDataReader in NpgSql 1



Thanks to google Alert, I received a mail about your post here with the answer:

http://forums.devshed.com/postgresql-help-21/behavior-of-npgsqldatareader-in-npgsql-1-and-npgsql-2t-617614.html

I'm quoting it here for historical purposes. Post from user Pabloj:


Not an expert on this but, as per it's site:
Quote:
Improved performance for large resultsetsifferent from Npgsql1,
Npgsql2 doesn't read all table contents before returning control to
user code. This makes Npgsql much more memory efficient when dealing
with large tables. Thanks Jon Hanna for this.
Check User Manual for more info about that and how to revert to old
behavior of loading all data if you need it.
Which might be related to the problem you're experiencing.
Check the user manual under Preload Reader(manual is here )
Note that, from the same site
Quote:
... Npgsql2 had a lot of improvements which represents a much more
stable product, more bugs fixed and many implemented methods. It is
strongly advised that current users update from Npgsql1 to Npgsql2

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

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Difference between in (...) and = any(...) queries when using arrays

2009-05-12 Thread Francisco Figueiredo Jr.
On Tue, May 12, 2009 at 05:02, Richard Huxton d...@archonet.com wrote:
 Francisco Figueiredo Jr. wrote:

 Hi all!

 I was playing with in (...)  and = any (...) queries and found a
 difference between them and I wonder:

 why this works:

 select * from table_of_integers where integer_column = any (array[5,6]);

 This checks if integer_column matches any value in the specified array.

 select * from table_of_integers where integer_column in (array[5,6]);

 This checks if integer_column IS an array[5,6] (which it isn't).

 You probably want ... IN (5,6)

 SOME is a synonym for ANY. IN is equivalent to = ANY.

 I think this is probably talking with respect to sub-queries.



A, thank you very much for your feedback and for explaining it, Richard.

Now I understand it better.

-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Difference between in (...) and = any(...) queries when using arrays

2009-05-11 Thread Francisco Figueiredo Jr.
Hi all!

I was playing with in (...)  and = any (...) queries and found a
difference between them and I wonder:

why this works:

select * from table_of_integers where integer_column = any (array[5,6]);

and this doesn't:

select * from table_of_integers where integer_column in (array[5,6]);

Although documentation says:

9.20.4. ANY/SOME

[...]
SOME is a synonym for ANY. IN is equivalent to = ANY.
[...]

I thought that if IN is equivalent to = any, both queries above should work.

Am I missing something?

Thanks in advance.



--
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] need information

2009-04-16 Thread Francisco Figueiredo Jr.
On Thu, Apr 16, 2009 at 02:12, Peeyush peeyush_j...@persistent.co.in wrote:

 Sorry missed the attachment L


No problem.

Thanks for the document with feature list of dotConnect.
I'll create one for Npgsql which can give more information. Npgsql is
missing a list like that for a long time.

Another missing feature from the list is the design time support. We
are working on that although we don't anything ready yet.

We also don't have something like pgdump or pgloader.

We don't have compact framework support


Those are the biggest features we are lacking. I can see a lot more
compared to dotConnect which we still would need to work on.

As soon as I compile the list I'll let you know.

Thanks for your interest in Npgsql. Your feedback also is very nice so
we can improve even more Npgsql.






 Peeyush Jain| Software Engineer –Netezza Dev | Persistent Systems Ltd

 peeyush_j...@persistent.co.in  | Cell: +91 9373069475 | Tel: +91 (20) 3023 
 6762

 Innovation in software product design, development and delivery- 
 www.persistentsys.com







 

 From: Peeyush [mailto:peeyush_j...@persistent.co.in]
 Sent: Thursday, April 16, 2009 10:37 AM
 To: 'franci...@npgsql.org'

 Cc: 'pgsql-general@postgresql.org'; 'npgsql-devel'
 Subject: RE: [GENERAL] need information



 Thanks a lot for kind information.



 Currently I am investigating on Npgsql and dotConnect …… because we have 
 feature list of dotConnect I attached the same for your quick reference but 
 we don’t have in Npgsql. If you can help me in this then it will be greatful 
 for me.



 Thanks  regards,

 Peeyush Jain | Software Engineer –Netezza Dev | Persistent Systems Ltd

 peeyush_j...@persistent.co.in  | Cell: +91 9373069475 | Tel: +91 (20) 3023 
 6762

 Innovation in software product design, development and delivery- 
 www.persistentsys.com









 -Original Message-

 From: francisco.figueiredo...@gmail.com 
 [mailto:francisco.figueiredo...@gmail.com] On Behalf Of Francisco Figueiredo 
 Jr.
 Sent: Wednesday, April 15, 2009 11:40 PM
 To: Peeyush
 Cc: pgsql-general@postgresql.org; npgsql-devel
 Subject: Re: [GENERAL] need information



 On Wed, Apr 15, 2009 at 07:57, Peeyush peeyush_j...@persistent.co.in wrote:

  Hey guys,

 

 

 





 Hi, Peeyush!



  I need some information on

 

  1. What are the best features of Npgsql product as compare to other

  commercial .net data providers?

 



 Well, the first one is that it is opensource. :)



 We are working actively on it and we try to provide as fast as

 possible the features our users need. Although some times we don't

 deliver them as fast as we wished :(



 We already have a very nice code base which can give you almost

 anything you would need in your programs.



 Please, give it a try and let us know what you think.





  2. If you have encountered any major problems, bugs or performance issue

  etc... With this product?

 



 Well, one of the biggest performance problems we have but we already

 did some performance tunning is with bytea handling. It used to take a

 lot of time with large data.



 Our current performance problem is with prepared statements. Npgsql

 still needs some tunning on this.





 I think this is it for while.



 As Albe already said, you would get a good feedback if you post your

 question to our forum.



 Thanks in advance.



 I hope it helps.







 

 

  Thanks in advance,

 

  Peeyush Jain| Software Engineer –Netezza Dev | Persistent Systems Ltd

 

  peeyush_j...@persistent.co.in  | Cell: +91 9373069475 | Tel: +91 (20) 3023

  6762

 

  Innovation in software product design, development and delivery-

  www.persistentsys.com

 

 

 

 

 

 

 

  DISCLAIMER == This e-mail may contain privileged and confidential

  information which is the property of Persistent Systems Ltd. It is intended

  only for the use of the individual or entity to which it is addressed. If

  you are not the intended recipient, you are not authorized to read, retain,

  copy, print, distribute or use this message. If you have received this

  communication in error, please notify the sender and delete all copies of

  this message. Persistent Systems Ltd. does not accept any liability for

  virus infected mails.







 --

 Regards,



 Francisco Figueiredo Jr.

 Npgsql Lead Developer

 http://www.npgsql.org

 http://fxjr.blogspot.com

 http://twitter.com/franciscojunior

 http://friendfeed.com/franciscojunior

 DISCLAIMER == This e-mail may contain privileged and confidential 
 information which is the property of Persistent Systems Ltd. It is intended 
 only for the use of the individual or entity to which it is addressed. If you 
 are not the intended recipient, you are not authorized to read, retain, copy, 
 print, distribute or use this message. If you have received this 
 communication in error, please notify the sender and delete all copies of 
 this message. Persistent Systems Ltd. does

Re: [GENERAL] need information

2009-04-15 Thread Francisco Figueiredo Jr.
On Wed, Apr 15, 2009 at 07:57, Peeyush peeyush_j...@persistent.co.in wrote:
 Hey guys,





Hi, Peeyush!

 I need some information on

 1. What are the best features of Npgsql product as compare to other
 commercial .net data providers?


Well, the first one is that it is opensource. :)

We are working actively on it and we try to provide as fast as
possible the features our users need. Although some times we don't
deliver them as fast as we wished :(

We already have a very nice code base which can give you almost
anything you would need in your programs.

Please, give it a try and let us know what you think.


 2. If you have encountered any major problems, bugs or performance issue
 etc... With this product?


Well, one of the biggest performance problems we have but we already
did some performance tunning is with bytea handling. It used to take a
lot of time with large data.

Our current performance problem is with prepared statements. Npgsql
still needs some tunning on this.


I think this is it for while.

As Albe already said, you would get a good feedback if you post your
question to our forum.

Thanks in advance.

I hope it helps.





 Thanks in advance,

 Peeyush Jain| Software Engineer –Netezza Dev | Persistent Systems Ltd

 peeyush_j...@persistent.co.in  | Cell: +91 9373069475 | Tel: +91 (20) 3023
 6762

 Innovation in software product design, development and delivery-
 www.persistentsys.com







 DISCLAIMER == This e-mail may contain privileged and confidential
 information which is the property of Persistent Systems Ltd. It is intended
 only for the use of the individual or entity to which it is addressed. If
 you are not the intended recipient, you are not authorized to read, retain,
 copy, print, distribute or use this message. If you have received this
 communication in error, please notify the sender and delete all copies of
 this message. Persistent Systems Ltd. does not accept any liability for
 virus infected mails.



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior
http://friendfeed.com/franciscojunior

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Question about functions that return a set of records

2009-02-20 Thread Francisco Figueiredo Jr.
On Fri, Feb 20, 2009 at 3:50 AM, Mike Christensen ima...@comcast.net wrote:
 I have the following function:

 CREATE FUNCTION foo(_userid uuid)
  RETURNS SETOF record AS
 $BODY$
 BEGIN
  RETURN QUERY
   select n.UserId, u.Alias, n.Date, n.Data
   --Bunch of joins, etc

 If I understand correctly, I have to return SETOF record since my result
 set doesn't match a table and isn't a single value.  However, this means
 when I want to call it I have to provide a column definition list, such as:

 select * from foo as (...);

 Is there any way to specify this column list within the function itself?
  The problem I'm running into is I want to call this function using Npgsql
 which doesn't appear to support passing in a column definition list.


Hmm, Npgsql supports this syntax when your function returns a record.
But I think it is easy to add support for a setof record.
I'll check it out.

To use the support of record in Npgsql, you just need to specify your
parameters which will receive the returned values (the output list)
as out parameters. Npgsql will take care of them and build the output
list for you when calling your function.

commandtext = function_name;
command.parameters.add(first parameter));
command.parameters[0].Direction = InDirection;


command.parameters.add(second parameter));
command.parameters[1].Direction = OutDirection;


command.parameters.add(Third parameter));
command.parameters[2].Direction = OutDirection;

And when you call your function, Npgsql will pass your first parameter
and build the output list with the second and third parameters.

For while, if possible, you could use Npgsql support for returning
setof refcursor. You can check examples about how to do that
in our user manual: http://manual.npgsql.org

I hope it helps.


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to convert ByteA to Large Objects

2009-01-23 Thread Francisco Figueiredo Jr.
On Fri, Jan 23, 2009 at 10:08 AM, Howard Cole howardn...@selestial.com wrote:
 Hi All,


Hi, Howard!

 Is there some nice SQL I can use to convert a BYTEA field into large
 objects?

 I am having some memory problems handling bytea parameters in Npgsql -
 getting out of memory errors. From reading various posts on this I see that
 bytea's can consume much more memory than the size of the object so I am
 going to convert these bytea's to large objects so I can chunk the data.


About the memory issue of Npgsql, did you try to use a prepared
statement for this? We have some performance improvements when
handling bytea values but only when the NpgsqlCommand.Prepare() method
is called.

I hope it helps.



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to convert ByteA to Large Objects

2009-01-23 Thread Francisco Figueiredo Jr.
On Fri, Jan 23, 2009 at 11:25 AM, Howard Cole howardn...@selestial.com wrote:
 Francisco Figueiredo Jr. wrote:

 About the memory issue of Npgsql, did you try to use a prepared
 statement for this? We have some performance improvements when
 handling bytea values but only when the NpgsqlCommand.Prepare() method
 is called.

 I hope it helps.



 Hi Francisco,


Hi, Howard!

 Yes it did help. Thank you very much. (P.S. Npgsql is great!)


Great! I'm glad to hear it.
And thank you for using Npgsql!

 Thanks.


You are welcome!



-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Installing the Npgsql provider for .Net

2009-01-06 Thread Francisco Figueiredo Jr.
On Tue, Jan 6, 2009 at 5:38 PM, Rob Richardson
rob.richard...@rad-con.com wrote:
 Greetings!


Hi, Rob!

You can find the manual in the download file which has a section about
how to install and use Npgsql.

Also, you can find the user manual online at:
http://manual.npgsql.org

You will need to add the file Mono.Security.dll into the GAC as
Npgsql.dll depends on it.
This file is also found in the downloaded file. Maybe you got one for
Mono which already contains the Mono.Security.dll assembly.

If you read the manual and still have doubts, please let us know.

I hope it helps.


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Generic provider for .Net

2009-01-06 Thread Francisco Figueiredo Jr.
On Tue, Jan 6, 2009 at 7:00 PM, Rob Richardson
rob.richard...@rad-con.com wrote:
 My stumbling through the wilds of .Net, ADO.Net and PostGRESQL continues...



With this requirement, I would suggest you to use dbproviderfactory
support of .Net

This is a sample link with informations about it:

http://msdn.microsoft.com/en-us/library/dd0w4a2z%28VS.80%29.aspx

http://www.davidhayden.com/blog/dave/archive/2007/10/08/CreatingDataAccessLayerUsingDbProviderFactoriesDbProviderFactory.aspx


A little googling can provide you with more examples.

Also, on Npgsql manual there is the entry you have to make to register
Npgsql as a dbproviderfactory.

Also note that Npgsql supports sqlclient parameter style with the '@'
prefix to easy porting sql code from sqlserver to postgresql.

I hope it helps.


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] postgresql and Mac OS X

2008-11-04 Thread Francisco Figueiredo Jr.
On Tue, Nov 4, 2008 at 8:21 AM, Tom Allison [EMAIL PROTECTED] wrote:
 Grzegorz Jaśkiewicz wrote:

 I feel good about control here, and I certainly don't have any problems.
 So, please don't whine :)
 Especially since I want to run cvs head, and be able to actually update it
 from cvs when I want to, that's the only choice. Postgresql is so easy to
 get from sources, compared to other software packages, I can't understand
 people even with slightest expierence in unix to have any problems with it.

 I tried getting a source install on my mac book yesterday and today.
 It's not a normal *nix installation.  The location of the files are all
 non-standard.
 'make' is prefixed by /Developer/usr/bin/.

 I added /Developer/usr/bin to PATH and tried ./configure.

 checking build system type... i386-apple-darwin9.5.0
 checking host system type... i386-apple-darwin9.5.0
 checking which template to use... darwin
 checking whether to build with 64-bit integer date/time support... no
 checking whether NLS is wanted... no
 checking for default port number... 5432
 checking for gcc... gcc
 checking for C compiler default output file name... configure: error: C
 compiler cannot create executables
 See `config.log' for more details.


 config.log shows an exit code of 77 with a statement that compiler cannot
 create executables.  ???


 configure:2213: $? = 0
 configure:2215: gcc -v /dev/null 5
 Using built-in specs.
 Target: i686-apple-darwin9
 Configured with: /var/tmp/gcc/gcc-5488~2/src/configure --disable-checking
 -enabl
 e-werror --prefix=/usr --mandir=/share/man
 --enable-languages=c,objc,c++,obj-c++
  --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/
 --with-gxx-include-dir=/includ
 e/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9
 --with-arch=apple
  --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
 Thread model: posix
 gcc version 4.0.1 (Apple Inc. build 5488)
 configure:2218: $? = 0
 configure:2220: gcc -V /dev/null 5
 gcc-4.0: argument to `-V' is missing
 configure:2223: $? = 1
 configure:2246: checking for C compiler default output file name
 configure:2249: gccconftest.c  5
 ld: library not found for -lcrt1.10.5.o
 collect2: ld returned 1 exit status
 configure:2252: $? = 1
 configure: failed program was:


 I think he questin is, what lib was missing so I can go find it and add it
 to some path/dir variable?



I think you need to install the developer tools.

I compile postgresql from sources with no problem on osx 10.5.4 but I
installed developer tools before.

The library which is missing is the following:

 configure:2246: checking for C compiler default output file name
 configure:2249: gccconftest.c  5
 ld: library not found for -lcrt1.10.5.o  -

crt1.10.5.o

I hope it helps.





-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Why select 1 where current_date = 'infinity'; doesn't work?

2008-10-14 Thread Francisco Figueiredo Jr.
It gives me the following error:

ERROR:  invalid input syntax for type date: infinity

I thought I could use it anywhere in my sql.

I have to add a cast to timestamp in order for this to work. I thought
I wouldn't need to use a case.

Am I missing something?

Thanks in advance.


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Why select 1 where current_date = 'infinity'; doesn't work?

2008-10-14 Thread Francisco Figueiredo Jr.
On Tue, Oct 14, 2008 at 1:18 PM, Tom Lane [EMAIL PROTECTED] wrote:
 Francisco Figueiredo Jr. [EMAIL PROTECTED] writes:
 ERROR:  invalid input syntax for type date: infinity
 I thought I could use it anywhere in my sql.

 No, only timestamps support infinity.

 We do have a TODO item to allow type date to do that too.  It's been asked
 for often enough, not sure why it hasn't happened.  Seems easy enough,
 maybe I'll go do it.


Thank you very much, Tom, for your feedback on this!!

I will update our forum discussion with this information.

I know this may sound a little bit uncommon, but to me it's an honor
to know you are paying attention to my message! :)

Thanks again.

-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Some server processes stalled with aborted client sockets

2008-08-31 Thread Francisco Figueiredo Jr.
On Thu, Aug 28, 2008 at 1:42 AM, Francisco Figueiredo Jr.
[EMAIL PROTECTED] wrote:
 Hi all!


Any clues about this?

Thanks in advance.


 I'm playing with client thread abort issues in Npgsql. And with a test
 sample one of our users provided us we are seeing that even after the
 client finishes its processing, I'm seeing some stalled server
 processes processing the query.

 The problem is that those server processes seem not to die when the
 client disconnects. Even worse, if I try to stop server, because of
 then, the server can't shutdown.

 Have you seen something like that? Is it possible that I can mess up
 with frontend protocol so that the server process keeps waiting for
 something?

 What is strange is that even after the socket is closed, the server
 process is still there.

 Also, I'd like to ask what is the best way of handling an abrupt
 client abortion. On my tests I'm doing the following: I'm sending a
 cancelrequest message followed by closing the socket. I know this
 isn't the most elegant way of doing it. For me the ideal would be to
 clear the protocol from any garbage the abrupt interruption may let it
 and return the connection to our internal pool. But I don't have any
 idea about how to clear the protocol state other than send the
 cancelrequest and try to eat any still existent byte in the stream
 until I receive an errorresponse or readyforquery (in case the query
 was successfully executed before the cancelrequest) But this approach
 may lead me to read up too much bytes before cleaning the protocol, or
 am I missing something?




 I'm using Postgresql 8.3.3 on OSX 10.5.4

 Thanks in advance for any advice about this issue.



 --
 Regards,

 Francisco Figueiredo Jr.
 http://fxjr.blogspot.com
 http://www.npgsql.org




-- 
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Some server processes stalled with aborted client sockets

2008-08-27 Thread Francisco Figueiredo Jr.
Hi all!

I'm playing with client thread abort issues in Npgsql. And with a test
sample one of our users provided us we are seeing that even after the
client finishes its processing, I'm seeing some stalled server
processes processing the query.

The problem is that those server processes seem not to die when the
client disconnects. Even worse, if I try to stop server, because of
then, the server can't shutdown.

Have you seen something like that? Is it possible that I can mess up
with frontend protocol so that the server process keeps waiting for
something?

What is strange is that even after the socket is closed, the server
process is still there.

Also, I'd like to ask what is the best way of handling an abrupt
client abortion. On my tests I'm doing the following: I'm sending a
cancelrequest message followed by closing the socket. I know this
isn't the most elegant way of doing it. For me the ideal would be to
clear the protocol from any garbage the abrupt interruption may let it
and return the connection to our internal pool. But I don't have any
idea about how to clear the protocol state other than send the
cancelrequest and try to eat any still existent byte in the stream
until I receive an errorresponse or readyforquery (in case the query
was successfully executed before the cancelrequest) But this approach
may lead me to read up too much bytes before cleaning the protocol, or
am I missing something?




I'm using Postgresql 8.3.3 on OSX 10.5.4

Thanks in advance for any advice about this issue.



-- 
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Postres.exe Processes Hang

2008-08-18 Thread Francisco Figueiredo Jr.
On 8/18/08, Magnus Hagander

Hi, all!
As Magnus said, this is caused by the fact Npgsql does connection pool
by default.
You can change that by passing pooling=false in your connection string.

You can get more info at
manual.npgsql.org

I hope it helps


[EMAIL PROTECTED] wrote:
 Kim Robinson wrote:


 Hi,

 I am using the npgsql postgres data adaptor in a C# ASP.NET application.
 Each time the site establishes a new connection to the database a
 postgres.exe process is started. For some reason this process is not
 removed when the connection is closed.

 Any help would be greatly appreciated.

 Are you by any chance using some connection pooling that keeps it alive?
 I don't remember what the default is in npgsql, but a lot of frameworks
 have connection pooling enabled by default.

 //Magnus

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general



-- 
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
http://www.npgsql.org


-- 
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Postres.exe Processes Hang

2008-08-18 Thread Francisco Figueiredo Jr.
On Mon, Aug 18, 2008 at 9:59 PM, Kim Robinson [EMAIL PROTECTED] wrote:
 Great thanks all.
 Can you give me any indication of the performance implications of
 setting pooling=false?


Yeap. All the time you would need to connect to postgresql you will
have the overhead of tcp connection establishment as well as the
overhead of postgresql authentication.

I don't know how much this is in time, but you can give it a try with
some tests which opens a connection, do a simple query like select
version() and close it.

I think you could see something like 2 or 3 times slower than with the
pool enabled.


-- 
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to create a function with multiple RefCursor OUT parameters

2008-05-17 Thread Francisco Figueiredo Jr.
On Fri, May 16, 2008 at 10:06 AM, Merlin Moncure [EMAIL PROTECTED] wrote:
 On Fri, May 16, 2008 at 2:17 AM, Albe Laurenz [EMAIL PROTECTED] wrote:
 Chuck Bai wrote:


Hi, Chuck!

What's the Npgsql code you are using to call this function?

Thanks in advance.


-- 
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] select statement fails

2008-04-09 Thread Francisco Figueiredo Jr.
 
 

  Ask the .npgsql mailing lists. They'll be able to tell you. There must be a
 way of handling non-standard types in any case.


Hi all!

We are already working on that. The cast problem is indeed a bug in
Npgsql. We already have a one line fix for it.

Check it out here:

http://pgfoundry.org/forum/message.php?msg_id=1003377

I hope it helps.




-- 
Regards,

Francisco Figueiredo Jr.
fxjr.blogspot.com
www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] connecting VB to postgreSQL

2008-04-09 Thread Francisco Figueiredo Jr.
On Wed, Apr 9, 2008 at 7:20 AM, leoabhi [EMAIL PROTECTED] wrote:

   Hello,

Hello Abhi!

   I wish to connect Visual Studio 2008(VB) to PostgreSQL..


Have you tried Npgsql?

http://www.npgsql.org
http://project.npgsql.org
http://documentation.npgsql.org

I hope it helps.


-- 
Regards,

Francisco Figueiredo Jr.
fxjr.blogspot.com
www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] select statement fails

2008-04-09 Thread Francisco Figueiredo Jr.
On Wed, Apr 9, 2008 at 1:31 PM, Francisco Figueiredo Jr.
[EMAIL PROTECTED] wrote:
  
   
  
Ask the .npgsql mailing lists. They'll be able to tell you. There must be 
 a
   way of handling non-standard types in any case.
  

  Hi all!

  We are already working on that. The cast problem is indeed a bug in
  Npgsql. We already have a one line fix for it.

  Check it out here:

  http://pgfoundry.org/forum/message.php?msg_id=1003377

  I hope it helps.



Patch applied!

Please, grab latest cvs code and give it a try. Note that you still
will receive an string when working with char columns. But you will be
able to assign char values to NpgsqlParameters without any problem.

Please, let us know if you have any problems.




-- 
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
http://www.npgsql.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general