Re: [HACKERS] tolower() identifier downcasing versus multibyte encodings

2011-03-21 Thread Francisco Figueiredo Jr.
I just received a feedback from our bug report about this problem and
it seems the problem also occurred on a windows machine.

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



On Sat, Mar 19, 2011 at 14:13, Marko Kreen  wrote:
> On Sat, Mar 19, 2011 at 5:05 PM, Tom Lane  wrote:
>> Marko Kreen  writes:
>>> On Sat, Mar 19, 2011 at 6:10 AM, Tom Lane  wrote:
>>>> Or we could bite the bullet and start using str_tolower(), but the
>>>> performance implications of that are unpleasant; not to mention that
>>>> we really don't want to re-introduce the "Turkish problem" with
>>>> unexpected handling of i/I in identifiers.
>>
>>> How about first pass with 'a' - 'A' and if highbit is found
>>> then str_tolower()?
>>
>> Hm, maybe.
>>
>> There's still the problem of what to do in src/port/pgstrcasecmp.c,
>> which won't have the infrastructure needed to do that.
>
> You mean client-side?  Could we have a str_tolower without xxx_l
> branch that always does wide-char conversion if high-bit is set?
>
> Custom locale there won't make sense there anyway?
>
> --
> marko
>



-- 
Regards,

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

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


Re: [HACKERS] Protocol 3, Execute, maxrows to return, impact?

2008-07-28 Thread Francisco Figueiredo Jr.
On Mon, Jul 28, 2008 at 3:36 PM, Andrew Garner
<[EMAIL PROTECTED]> wrote:
>
> On 7/27/08, Stephen R. van den Berg <[EMAIL PROTECTED]> wrote:
>>
>> Stephen R. van den Berg wrote:
>> >My Pike drivers now support multiple simultaneous portals and
>> >automatic streaming by presending overlapping Execute statements with
>> >a dynamically adapted fetchlimit calculated per select as the query
>> >progresses.
>>
>>
>> They also support COPY now.
>>
>> The driver beats libpq in speed by about 62%.
>> The memory consumption is on demand, by row, and not the whole result set.
>> Transport to and from the query is in binary and dynamically determined
>> per datatype, no quoting necessary.
>>
>> Anyone interested in taking a peek at the (GPL copyright) driver, I
>> temporarily put up a small package which contains the working driver
>> in Pike at:
>>
>>http://admin.cuci.nl/psgsql.pike.tar.gz
>
> I'd love to take a look at the code, but the link seems to be 404'd at the
> moment.
>

Hi, I'd love to take a look at the code too. I'm the lead developer of
Npgsql a .Net data provider for postgresql which implements the
protocol 2 and 3. And have been following this thread so I could get
more info about protocol implementation internals so we could use in
our .net implementation. Currently we don't support multiple
resultsets yet.

Also, I'd like to get some ideas about how to optimize throughput. You
said you got a huge improvement compared to libpq. I think you may
implement some nice ideas which we could use to optimize Npgsql.

I'm also getting 404 error when trying to download the code.




-- 
Regards,

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

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


Re: [HACKERS] SQL fast in PSQL, very slow using MS.NET driver

2008-04-10 Thread Francisco Figueiredo Jr.
On Thu, Apr 10, 2008 at 5:27 AM, Ashish Sharma <[EMAIL PROTECTED]> wrote:
> Thanks for the response. Below are the details:
>
>  >
>  >  What queries are you running?
>
>  We are running normal SQLs and DMLs. Even simple queries like "select * 
> from..." are showing the described behavior.
>
>  >  What version of Npgsql?
>
>  NPGSQL ver. 1.97.1.0
>

No performance problem with it. But it may be good to update to our
latest beta3 release.

> >
>  >  Are you using prepared statements? We have performance issues with
>  >  prepared statements. If it is so, can you try without prepared
>  >  statements?
>
>  We are not you prepared statements.
>

Ok.

>
>  >
>  >  You can discuss this also in our forums:
>  >
>  >  forums.npgsql.org
>  >
>
>  The dotNet version we are using is 2.0, PostgreSQL 8.2.4 (on RHEL4)
>
>  Appreciate the support.
>

You are welcome.

Please, when using forums, give us what queries you are running so we
can make some tests to see what can be happening.

Thanks in advance, Ashish.



-- 
Regards,

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

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


Re: [HACKERS] SQL fast in PSQL, very slow using MS.NET driver

2008-04-09 Thread Francisco Figueiredo Jr.
On Wed, Apr 9, 2008 at 10:56 AM, Hannu Krosing <[EMAIL PROTECTED]> wrote:
>
>  On Wed, 2008-04-09 at 18:33 +0530, Ashish Sharma wrote:
>  > Hi,
>  >

Hi, all!!

>  > The setup in question includes PostGRESQL v8.2.4, Java based web
>  > servers and MS.NET based web servers. Following is the fuzzy
>  > situation:
>  >
>  > 1.  Our SQL queries run very fast using PSQL (both, from the
>  > server as well as the client).
>  >
>  > 2.  The Java app also retrieves the results very fast (of course,
>  > we are using Postgres JDBC driver).
>  >
>  > 3.  But, the same SQL queries perform pathetically slow when
>  > called from .NET application. The driver being used is NPGSQL.
>  >
>  >


What queries are you running?

What version of Npgsql?

Are you using prepared statements? We have performance issues with
prepared statements. If it is so, can you try without prepared
statements?

You can discuss this also in our forums:

forums.npgsql.org

Thanks in advance.



-- 
Regards,

Francisco Figueiredo Jr.
fxjr.blogspot.com
www.npgsql.org

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


Res: [HACKERS] .NET driver

2007-08-03 Thread Francisco Figueiredo Jr.


Hi all!

I know this is OT, sorry for that.

I just wanted you to know that I've read this thread and welcome any and all 
help in order to get Npgsql in best shape as possible.

As pointed out by Robert, join us on Npgsql Forums so we can discuss. This 
would be very nice! 

I also agree with Brar Piening about the need to have better interfaces and 
Npgsql Team hopes to get Npgsql in a great standard so it is easier for .net 
developers out there to start using Postgresql and enjoy working with Npgsql 
and Postgresql! :) That's what I want to happen.

Andrei, it would be very nice if you could join us to help make Npgsql better! 

Thanks in advance.

 
--
Regards, 
Francisco Figueiredo Jr.
http://fxjr.blogspot.com
 
Npgsql Lead Developer
http://npgsql.projects.postgresql.org
 
Mono Project Contributor
http://www.go-mono.com
 
MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org
 

 - Would you tell me, please, which way I ought to go from here?
 - That depends a good deal on where you want to get to.
-- Lewis Carroll "Alice's Adventures in Wonderland"

- Mensagem original 
De: Robert Treat <[EMAIL PROTECTED]>
Para: pgsql-hackers@postgresql.org
Cc: Andrei Kovalevski <[EMAIL PROTECTED]>
Enviadas: Quinta-feira, 2 de Agosto de 2007 12:49:56
Assunto: Re: [HACKERS] .NET driver

On Thursday 02 August 2007 08:57, Andrei Kovalevski wrote:
> Merlin Moncure wrote:
> > On 8/2/07, Hannu Krosing <[EMAIL PROTECTED]> wrote:
> >> Ühel kenal päeval, N, 2007-08-02 kell 11:24, kirjutas Rohit Khare:
> >>> I used NPGSQL .NET driver to connect PGSQL 8.2.4 database to VB.NET.
> >>> As stated on NPGSQL page, it doesn't seem to provide seamless
> >>> integration and performance with .NET. Instead when I used ODBC, the
> >>> performance was comparatively better. What's the reason? When can we
> >>> expect .NET driver that provides seamless integration.
> >>
> >> What kind of "seamless integration" are you looking for ?
> >
> > The .net data provider is not as good when working with typed datasets
> > in terms of support from the ide.  Normally for other providers the
> > IDE does everything for you, writing update statements and  such in a
> > ORM fashion.   This is kind of a pain for some of the report designers
> > and other things that want to work with a typed set.  It's possible to
> > work around this, it's just a pain, and changes with each release of
> > visual studio.  Also, the connection pooling portions are buggy
> > (google LOG: incomplete startup packet).
> >
> > The ODBC driver works pretty good actually.  I can't speak about the
> > performance though.
> >
> > merlin
>
> I have an experience with writing ODBC driver for PostgreSQL
> (https://projects.commandprompt.com/public/odbcng/). I would be happy to
> help community to improve .NET data provider.
>

That would be nice. Of course none of this seems relevant to hackers, so I'd 
ask those interested to check out the .net project page at 
http://pgfoundry.org/projects/npgsql/  

-- 
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate






  Alertas do Yahoo! Mail em seu celular. Saiba mais em 
http://br.mobile.yahoo.com/mailalertas/

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


[HACKERS] SIg11 on suse linux

2006-08-12 Thread Francisco Figueiredo Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


Hi all,

A friend is getting sig11 on suse linux while trying to establish any
connection to postgresql. Have you seen anything like that? He is using
Postgresql 8.1.4.

He compiled Postgresql with a common ./configure --with--ssl
- --prefix=/usr/local


After compiling and running initdb as soon as he tries to run createdb,
he get sig11 on server.

I tried the same here and I could get it working ok. The difference is
that I'm using Gentoo. Do you know if there is some detail about
compiling Postgresql on suse?

Thanks in advance.



- --
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
Npgsql Lead Developer
http://pgfoundry.org/projects/npgsql
MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBRN4zKP7iFmsNzeXfAQI2jgf+Ih+cFc+HuzmNskNPqqNWmRppeQI3sSLA
/fLlhDjI3R2JjX0M+fp69Q5ZikWy+muCuV1d7iI8SoqgtwsuQZS4xiAZUXa5wbXS
78/bCjUVixG4n4dDXm/WbkYyg2U0o6bAAGz6LW4xi1kHgvnTCFwyYYSz9fzAshff
Z6CtARHxColWvaZeCyOVHkrqFj8og1MzitqnW8KCR2tYnnlECTwZB6zdaE9rgobm
5IUmH3dlFZ0j0S4i0jAR+MSUMKfoZk8N4NZaT6dcHBtrHlGt0BiQT7bLX4Jhb48I
cuHkwyWdy7gShIHjDNStMXq/E7IdVR6+Ptn+XQb1e48SDtIzu/2phg==
=xIOz
-END PGP SIGNATURE-


___ 
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. 
Registre seu aparelho agora! 
http://br.mobile.yahoo.com/mailalertas/ 
 


---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [Bulk] Re: [HACKERS] [Bug] Server Crash, possible security exploit,

2005-12-14 Thread Francisco Figueiredo Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Martijn van Oosterhout wrote:
> On Mon, Dec 12, 2005 at 06:26:25PM -0200, Francisco Figueiredo Jr. wrote:
>>
>>


Hi all,


Yesterday I received a reply from Tom Lane who confirmed the bug and
promptly replied me with a patch!! :)


Thank you very much all for helping me with that.



- --
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.pgfoundry.org/projects/npgsql
MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org


- -
"Science without religion is lame;
religion without science is blind."

  ~ Albert Einstein
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEUAwUBQ6BKlv7iFmsNzeXfAQLDbQf2O3pVPbVSCLVVBBKn2rOpx5hhDBVcqC3B
LhuPJ5hIPAoxT4MPWfunOCIWYWw3NkK8eXDY55SI8xTIh84KSealcJVQpdDUAte0
tx6u4k/DqgODO/oXKxM73L90PBZdv7Z9rk+kz40CesATs2hngrPjgMFL7Msga7G8
uTjQNVXMMmONw9xkTnw38RKvJRtcHlZGtCH2WyE1OU/IzFLNPpJdd5TUcd1E3NMy
ZRw/CQLtsXYnOplY1ueIyFCC1iWmQa2jHe65nAP564YPQjvUIpIfkNZzx6Lqu3MW
FSxkF4hIaXHHdrzBJjiTsfpSIhGeTVNkoTYNEM1B1pOFTPrL1QoZ
=/lxZ
-END PGP SIGNATURE-





___ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 


---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [Bulk] Re: [HACKERS] [Bug] Server Crash, possible security exploit,

2005-12-13 Thread Francisco Figueiredo Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Martijn van Oosterhout wrote:
> On Mon, Dec 12, 2005 at 06:26:25PM -0200, Francisco Figueiredo Jr. wrote:
> 
> Well, you're not giving any details but if you can cause the server to
> dump core in a standard installation, we're interested. You didn't
> specify your version BTW.
> 


Hi Martijn. Sorry for giving so little information. I was afraid that
any other info I could say here could be used later. I just sent the
message as specified in bug writing. I should have searched the manual
before posting here :) Thanks for info.


The postgresql version I first saw this problem was 8.0.3. I downloaded
and tested it with 8.1.0 and it also showed the problem.

> Here has instructions, including for security related stuff:
> http://www.postgresql.org/docs/current/static/bug-reporting.html
> 
> Have a nice day,

Thank you very much Martijn.


- --
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.pgfoundry.org/projects/npgsql
MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org


- -
"Science without religion is lame;
religion without science is blind."

  ~ Albert Einstein
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBQ577Mf7iFmsNzeXfAQJoCAgAm0B/ZkQK5ujvMrjdKEThLB7dEaC+39Vi
+edJvz+/czkfEbFnochgSR3p0j2W2A742RBXtRiVwB0zS35lEAjeouEaOIte73JB
j3h/qSOaJEerCKaaKx3DGEhf7iHlQQHQLv+hOoDdZNU9sP/ohwV2x/RU0K+XhDxD
vVpWn4SjDrZzmnV4Kn1FWlxNQ3BqJCjjXSIkNYtTuyJdg8T/wLFp63/RMMl0QfpT
2LYPuAb57MPNht0saPXb2T7zolJNKOQJQ08kTBQ3skdh/dbN2k350LnXbcGfs7hg
itC1wlFhkHAZEbFOqLI+dYa6+vfHFtPS7YJSDp8v4kCpQXmkAZrqjQ==
=xbU7
-END PGP SIGNATURE-





___ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[HACKERS] [Bug] Server Crash, possible security exploit, where to send security report?

2005-12-12 Thread Francisco Figueiredo Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1




Hi all,

while playing with Npgsql I faced an
strange behavior of Postgresql server.


I have all the details of it and I thought it could be a severe security
exploit, so I don't send it in clear to this mailing list directly as, I
think, anybody with this information could Dos postgresql servers.


Please, send me information to where/who I should send the details in
order this can be fixed as soon as possible.


This is the log I get when I receive the problem. I think that as server
is killing all processes, any client which can do that can kill all
client connections to that server. That's why I think it is very dangerous.


DEBUG:  server process (PID 2874) was terminated by signal 11
LOG:  server process (PID 2874) was terminated by signal 11
LOG:  terminating any other active server processes
DEBUG:  sending SIGQUIT to process 2111
DEBUG:  sending SIGQUIT to process 2112
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted at 2005-12-12 17:54:12 BRST
LOG:  checkpoint record is at 0/38E290
LOG:  redo record is at 0/38E290; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 619; next OID: 24576
LOG:  next MultiXactId: 1; next MultiXactOffset: 0
LOG:  database system was not properly shut down; automatic recovery in
progress
LOG:  record with zero length at 0/38E2D4
LOG:  redo is not required
LOG:  database system is ready
LOG:  transaction ID wrap limit is 2147484148, limited by database
"postgres"


- --
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.pgfoundry.org/projects/npgsql
MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org


- -
"Science without religion is lame;
religion without science is blind."

  ~ Albert Einstein
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBQ53c8f7iFmsNzeXfAQIIhgf9ENy4JADnkmkTzvegHtLjOxv9Qc7Tc5nr
z3uHOS3cV+I/0x6iu+DFu27uioCZV+/n8kuhNCE7r7q5kfIXu/NFRF2sULacH2bf
qT1oeL9IxB1DH/MStPADZAXNaDqvuKBOacACHjjisOFalOBFuymjpVMI+idsKptK
gmZT3I3qrsTvkGjPCnsSML7vHerJKXSkhew1yPLzg/V0qx+S36q0A6aR0pUNAnLV
Js6k2bmTEZSljt7BXIR9ISrw2CA4UG71C/njGt+RFX8P1d0aXrMG5zClAd42aKsB
Gy4A4CBbNHCiP8BuSd01VIdzyZbbvMI9qkP/4/7Gdaym3MbAN0UMzQ==
=A0iI
-END PGP SIGNATURE-





___ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [HACKERS] Execute and PortalSuspended needs explicit transaction

2005-03-02 Thread Francisco Figueiredo Jr.
Oliver Jowett wrote:
Francisco Figueiredo Jr. wrote:
After some testing, I could send an Execute message with 2 as the manx
number of rows. After the second execute I get the following:
portal "" does not exist
Severity: ERROR
Code: 34000
I noticed that I could only get it working if I explicitly create a
transaction.
I thought it could be some Sync() messages I was sending after the first
execute, but when I removed them, I still get the problems.

If you're sending any Sync messages at all between the two Executes, it 
will indeed cause problems as Sync causes any implicitly-opened 
transaction to be closed, which will in turn invalidate any non-holdable 
portals.

Do you have a trace of all the messages sent?
-O

Hi Oliver.
Sorry for late response.
I have this sequence of calls from my client app:
Parse
Bind
Execute passing 2 as max rows.
And later a second Execute passing 2 as max rows.
Is there some flag or opt I can pass to postmaster so that it could log 
the messages received?

On this second execute I get the error I told you. If I use an explicit 
transaction, it works.

Thanks in advance.
--
Regards,
Francisco Figueiredo Jr.
Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org

-
"Science without religion is lame;
religion without science is blind."
  ~ Albert Einstein
---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] Execute and PortalSuspended needs explicit transaction

2005-03-01 Thread Francisco Figueiredo Jr.
 --- Oliver Jowett <[EMAIL PROTECTED]> escreveu: 
> Francisco Figueiredo Jr. wrote:
> 
> > After some testing, I could send an Execute message with 2 as the manx
> > number of rows. After the second execute I get the following:
> > 
> > portal "" does not exist
> > Severity: ERROR
> > Code: 34000
> > 
> > I noticed that I could only get it working if I explicitly create a
> > transaction.
> > 
> > I thought it could be some Sync() messages I was sending after the first
> > execute, but when I removed them, I still get the problems.
> 
> If you're sending any Sync messages at all between the two Executes, it 
> will indeed cause problems as Sync causes any implicitly-opened 
> transaction to be closed, which will in turn invalidate any non-holdable 
> portals.
> 

Ok.

The strange part to me is that even after removing the sync calls, I still got
the problem :(

> Do you have a trace of all the messages sent?
> 

I'm not at my devel box right now, but when I get home I will send you.


Thanks in advance, Oliver.

Regards,

Francisco Figueiredo Jr.





___ 
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. 
http://br.acesso.yahoo.com/ - Internet rápida e grátis

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [HACKERS] [JDBC] Where are we on stored procedures?

2005-02-28 Thread Francisco Figueiredo Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Markus Schaber wrote:
| Hi, Francisco,
|
| Francisco Figueiredo Jr. schrieb:
|
|
|>In fact, I think people keep requesting me support on Npgsql for that
|>because MS Sql server supports it and they are porting their code to use
|>Postgresql and facing that difficult.
|>
|>Indeed, for (a) we could use an approach similar to Ms sql server. We
|>could have a way of the procedure say if it wanted to send the rows
|>affected information or not.
|>And about (b) I think that it is only on trivial cases that people
|>really want to use this feature :)
|
|
| As you need to tweak the function/procedure source to implement (a), you
| can also tweak the function/procedure to return the row cound and
| whatever other diagnostics you need.
Yeap, You are right.
|
| For newly implemented stored procedures, we could create a special
| diagnostics result set that every procedure creates. This usually
| contains some success/error information, but the procedure could add
| additional rows to it.
|
I think this could be a very good idea. I think you could create an
special tag which would say to create this special resultset or not as,
I think, not every stored procedure would need it.
I think this would be very nice.
Thanks Markus, for feedback.

- --
Regards,
Francisco Figueiredo Jr.
Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org

- -
"Science without religion is lame;
religion without science is blind."
~  ~ Albert Einstein
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iQEVAwUBQiPPOf7iFmsNzeXfAQLFYQgAkiBLkYi8lKQ6NNJ2qP48nH8PmODoe4Wp
FPB7lNvo9fLw0aw5rbztcu19FtvcJBJuFBFPc2LKImpszuJ2hcD02pTGqx3UxMR8
Yz3edTijCziHg8uBTiXQV0vHZ5WeE2/sEp+ve5heanDdzAcwLiCfDPxTR1XfVYaP
AJfLIHspwVkrXcEbtgwEdPX91QG/cLYjcRR/fhiaH4s8I3Hi3o9ZitQ4bkdOdosw
10+TMrgzbtXKdEOhWu9xgvdcujksjKi1xXXXSwr+L5WPi4y9iohnIi6X9j9wWlOw
fr9p2lYJgfzpq71Cl8dRlW+d0pRJFUlHiNaT/Adhzwsozc459Vix8Q==
=Jcuy
-END PGP SIGNATURE-
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


[HACKERS] Execute and PortalSuspended needs explicit transaction to work?

2005-02-28 Thread Francisco Figueiredo Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,
I'm playing with Execute messages with a non-zero max number of rows so
that I can get some PortalSuspended messages on Npgsql.
After some testing, I could send an Execute message with 2 as the manx
number of rows. After the second execute I get the following:
portal "" does not exist
Severity: ERROR
Code: 34000
I noticed that I could only get it working if I explicitly create a
transaction.
I thought it could be some Sync() messages I was sending after the first
execute, but when I removed them, I still get the problems.
Is this by design? I mean, do I need to have an explicit transaction to
get multiple executes work when getting portalsuspended messages? Or am
I missing something?
Thanks in advance.
- --
Regards,
Francisco Figueiredo Jr.
Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org

- -
"Science without religion is lame;
religion without science is blind."
~  ~ Albert Einstein
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iQEVAwUBQiPOIP7iFmsNzeXfAQKGEAgAgCoF0BhPXXaS/T2Wa97T1SD90N1hWs6j
DEfcfS2poXp+lLB64oLi1Q9gZAtzpHqDpYYsM5UA1JBtIE4X5ljOgtyKDdXhQVbM
hn0rtRGYE7TLFSowVvODsu7qrchbAQVcE+rlKd91QmO9S7ibXxXaE//xAjGKvSng
h4au7Id+dhZhjTJATFHBURV8IzJg3xK2/Kxg4BwY5p0yyUlBp+cHEv5ANBdvO1ms
QVQt5QnUHobeIFfAVZvh466n36I8UhvMVaFfCxnzgPiGv2t9fnKBUEcGJrwMghm0
emx0O3Xni6xWBdW3R/aHo+XoARfwdNiW89fm2YKxWPjGzqTZHjfjng==
=C5uE
-END PGP SIGNATURE-
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [HACKERS] [JDBC] Where are we on stored procedures?

2005-02-25 Thread Francisco Figueiredo Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Tom Lane wrote:
| "Francisco Figueiredo Jr." <[EMAIL PROTECTED]> writes:
|
|>Could I add another item?
|
|
|>Could we have the row count of statements executed inside a
|>procedure/function returned to client?
|
|
| IMHO that request is completely bogus; if the procedure wants to tell
| the client that, it's the procedure's responsibility to return the
| number as a result.  Doing what you ask (a) would arguably be a security
| violation, and (b) the info would be impossible for the client to
| interpret in any but the most trivial cases anyway.  Consider for
| instance a procedure that contains different queries in the THEN and
| the ELSE arms of an IF, or contains loops executed a variable number
| of times.  Without access to the results of the control flow tests, the
| client could not know which number means what.
Hi Tom Lane.
Thanks for feedback.
In fact, I think people keep requesting me support on Npgsql for that
because MS Sql server supports it and they are porting their code to use
Postgresql and facing that difficult.
Indeed, for (a) we could use an approach similar to Ms sql server. We
could have a way of the procedure say if it wanted to send the rows
affected information or not.
And about (b) I think that it is only on trivial cases that people
really want to use this feature :)
But thinking on other side I think this in only a differ in backend's
idiom. I already answered your solution of get diagnostics and I will
provide a litle FAQ about it so people can see how it is done on postgresql.
Regards,
Francisco Figueiredo Jr.
- --
Regards,
Francisco Figueiredo Jr.
Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org

- -
"Science without religion is lame;
religion without science is blind."
~  ~ Albert Einstein
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iQEVAwUBQh854P7iFmsNzeXfAQJ7UQf+Jqd4G7EE7YFyDLRBsuoGLZTYl7N/ZY0M
yeIgRbTNw3HPeHb+OiAI+MMXCWxu0YU4OgLOvqkls9NKHkeuMjdSwmsCfwPL0qfc
sZT6UqQJyap6skH1VJ7jQEhfgjesfpqYzUoyeJUJDiRyFsEbM4sbdnDdpMawf/jq
jgzx50lpgQtFOblsaMlfklLiUZa47FeMC8M64XcmzE+IIdfJcx0kWYQ+LKtoimNs
9SH7Z1v3lnNKvucLSw5eMT/y2Ldu8Qgr4/eK7JroKcI4JbHOlNtirrovAoinBjwB
Otcwtd2tRqffFCrF6MqsSzuXn+S2C4Wj9/0qWZ1CIzevigb+QfXOIw==
=h32q
-END PGP SIGNATURE-
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [HACKERS] [JDBC] Where are we on stored procedures?

2005-02-24 Thread Francisco Figueiredo Jr.
 --- Tom Lane <[EMAIL PROTECTED]> escreveu: 
> Gavin and Neil made some noise in late September about implementing
> stored procedures for PG 8.1, but I haven't heard anything more about
> it since that thread died off.  I've been getting some pressure inside
> Red Hat to see us support more of the JDBC CallableProcedure spec, so
> I'd like to reopen the discussion.
> 


I don't know if I can talk about it here, but here I go. Please let me know if
it is not appropriate.

> In the previous discussion starting here:
> http://archives.postgresql.org/pgsql-hackers/2004-09/msg00702.php
> it seemed that we were bandying around several different issues.
> People wanted "procedures" to differ from our current implementation
> of "functions" in such ways as:
> 
> 
> 2. Having OUT parameters, and perhaps also INOUT parameters.  At least
> in the JDBC spec, these are seen as scalar values, and so the feature
> is really just syntactic sugar for returning a composite type or row
> value.  For instance, a procedure foo(x IN int, y OUT text, z OUT float)
> could perhaps be called via
>   SELECT y, z FROM foo(42);
> where foo(x) is seen as returning the rowtype (y text, z float).
> 

That would be very good.


Could I add another item?

Could we have the row count of statements executed inside a procedure/function
returned to client?

I know Tom Lane, that you already talked about that this could be unnecessary,
but we from Npgsql sometimes get reports about the support of needing to know
the number of rows affected by a function/procedure call.

You told me about the get diagnostics ROWCOUNT and it worked like a charm, but
I was thinking about something without the need to change the procedure, as
even this modification needs some aware of client to be able to get the result.

Please, jdbc guys, if you know some easy way of doing this, please let me know
so I can implement in Npgsql.



Thanks in advance.

Regards,

Francisco Figueiredo Jr.


__
Converse com seus amigos em tempo real com o Yahoo! Messenger 
http://br.download.yahoo.com/messenger/ 

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [HACKERS] How to make @id or $id as parameter name in plpgsql,

2004-11-24 Thread Francisco Figueiredo Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Arnold.Zhu wrote:
| I want to use @id, @name as plpgsql's parameter, then I've no need to
change C# source,
| only change Npgsql driver not to trim "@" and stored procedure to plpgsql.
|
Hi Arnold,
Npgsql already supports parameter names starting with @. This was a
feature users were requesting exactly for the porpose of helping port
code from sql server to postgresql.
Please, let me know of any modifications you may still need to do to get
it working. I did some tests and it were working well.

- --
Regards,
Francisco Figueiredo Jr.
Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org

- -
"Science without religion is lame;
religion without science is blind."
~  ~ Albert Einstein
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iQEVAwUBQaVATf7iFmsNzeXfAQLaMAgAgVlHRnr3amZ0kEbocnYp8tiH17fClpHv
L4J/btccMlp/j4pGNiDujLKldXI9EozgzTZ1SyATw+NVTRRJqcDxA74iAfVIxA8n
ucNAXwkeAMg/ko/B93ked6h+sUbHtvojz64osVmB2Uu0VmqBORVhuHYUZhGD+5EV
6iW+1BzIAuY4hVExnL3DxOaqnHs8iFRGj4l5Vns0Vzdq8c11FSAr9AUYDuO8sU4H
TzVnynW56n7lotqo41+ejWU/wTBDgiic8X8ZmYYBe8VB6FZjyPiiwcIhlc3mExkw
UyAIsZZlA1GhUXMWkyLrbSMV1WPa/Bq7mXy/+vtWSZ9eO0iqfOQRhA==
=ha8i
-END PGP SIGNATURE-
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly


[HACKERS] Parse message problem, maybe a bug?

2004-09-24 Thread Francisco Figueiredo Jr.

Hi all,
Martijn, a user of Npgsql, sent me a query which is giving problems with 
postgresql using extended query mode.

The problem I'm having is in the Parse message. The parse message I'm 
sending is as follow:

select * from table where $1 in (select some_field from table)
Postgresql returns this error:
could not determine data type of parameter $1
Severity: ERROR
Code: 42P18
But I already have many working samples in the form for example:
insert into table(field1, field2) values ($1, $2)
The only way I could have it working was by adding the explicit type of 
parameter so the parse text is, for example for parameter of type text:

select * from table where $1::text in (select some_field from table)
Is this a bug in Postgresql or is this by design?
Thanks in advance.
Regards,
Francisco Figueiredo Jr.
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [HACKERS] Why select * from function doesn't work when function

2003-07-25 Thread Francisco Figueiredo Jr.
Nigel J. Andrews wrote:

On Thu, 24 Jul 2003, Francisco Figueiredo Jr. wrote:


Nigel J. Andrews wrote:


On Tue, 22 Jul 2003, Francisco Figueiredo Jr. wrote:



How's this for an alternative if you really don't want any rows returned:

create function fincF ( )  returns setof integer as '
begin
 delete from blah;
 return;
end;
' language 'plpgsql';

This works, but what I really want is not to return any rows. I mean, 
the problem is not return null, but the error I get if I select * from 
voidfunction.

I just wanted void functions behave like others when called as select * 

from voidfunction  So I dont have to do select voidfunction. :)


But that last does exactly that. Doesn't even return a null. Give it a quick
go, skip the delete statement obviously, and see. You'll get something like:
  ?
---
(0 rows)



Uhmmm, I think I didn't make myself clear. What I mean by void function 
wasn't a function which just doesn't return anything. What I meant is a 
function created like this:

create function voidfunction returns *void* as [...]


I knew what you meant but why the insistence on the void return type? All it's
saying is that there isn't any interpretation that can be applied to anything
that may (or may not) be returned from it so what are you trying to gain by
forcing the void type when you're forced into ignoring the result anyway?
Oh, good. I thought I was being a little confused and could be leading 
to some misunderstand. :)

I was faced by this when I received a bug report on Npgsql 
(http://gborg.postgresql.org/project/npgsql/bugs/bugupdate.php?554) 
about functions with void result wasn't being able to execute.

The problem is that internally, to get support of returning resultsets 
from function calls, I was calling all functions with select * from 
function. As I could call it this way regardless the function returned 
just a single value or a resultset. I wasn't aware of the void type and 
as Tom Lane also said now, other pseudotypes. So, I thought it was just 
the void type which had this problem, and I was asking about why it 
would behave differently from other types. I thougth it could be some 
missing type, and would be a easy fix. But now I see it isn't so simple :)




The problem to me is the void in the returns ;)

If you create a function with the returns void above you'll see that if 
you do select * from voidfunction it gives you the error I said. But it 
works with select voidfunction.


Well don't create the function as returning void :)

:)


I just wanted it to work with select * from voidfunction too. :)



I think I did most of mine as returning integer type and the value 1 (just for
something to return).
Yeah, this also would work.

Thanks Nigel for all your feedback.

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
 joining column's datatypes do not match


Re: [HACKERS] Why select * from function doesn't work when function

2003-07-25 Thread Francisco Figueiredo Jr.
Tom Lane wrote:

"Francisco Figueiredo Jr." <[EMAIL PROTECTED]> writes:

I just wanted void functions behave like others when called as select * 
from voidfunction  So I dont have to do select voidfunction. :)


It's not only void functions that fail --- I believe the code will
reject any pseudo-type, which includes several things:
regression=# select typname from pg_type where typtype = 'p';
 typname
--
 record
 cstring
 any
 anyarray
 void
 trigger
 language_handler
 internal
 opaque
 anyelement
(10 rows)
regression=#

Some of these might be safe to allow, but some clearly are not.

			regards, tom lane

Ohhh, I thought there was only the void type which had this behaviour. :)

So, I will have to use the select voidfunction();

Thanks Tom Lane.



--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [HACKERS] Why select * from function doesn't work when function

2003-07-24 Thread Francisco Figueiredo Jr.
Nigel J. Andrews wrote:

On Tue, 22 Jul 2003, Francisco Figueiredo Jr. wrote:


How's this for an alternative if you really don't want any rows returned:

create function fincF ( )  returns setof integer as '
begin
  delete from blah;
  return;
end;
' language 'plpgsql';

This works, but what I really want is not to return any rows. I mean, 
the problem is not return null, but the error I get if I select * from 
voidfunction.

I just wanted void functions behave like others when called as select * 
from voidfunction  So I dont have to do select voidfunction. :)


But that last does exactly that. Doesn't even return a null. Give it a quick
go, skip the delete statement obviously, and see. You'll get something like:
   ?
---
(0 rows)



Uhmmm, I think I didn't make myself clear. What I mean by void function 
wasn't a function which just doesn't return anything. What I meant is a 
function created like this:

create function voidfunction returns *void* as [...]

The problem to me is the void in the returns ;)

If you create a function with the returns void above you'll see that if 
you do select * from voidfunction it gives you the error I said. But it 
works with select voidfunction.

I just wanted it to work with select * from voidfunction too. :)

Thanks Nigel.



--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly


Re: [HACKERS] Why select * from function doesn't work when function

2003-07-22 Thread Francisco Figueiredo Jr.
Nigel J. Andrews wrote:

On Tue, 22 Jul 2003, Francisco Figueiredo Jr. wrote:


select * from funcF();

Yeap, it works, but you specified integer as the return type :)


Yes, that's because I knew the void wouldn't work. :]

:)

How's this for an alternative if you really don't want any rows returned:

create function fincF ( )  returns setof integer as '
 begin
   delete from blah;
   return;
 end;
' language 'plpgsql';

This works, but what I really want is not to return any rows. I mean, 
the problem is not return null, but the error I get if I select * from 
voidfunction.

I just wanted void functions behave like others when called as select * 
from voidfunction  So I dont have to do select voidfunction. :)



--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] Why select * from function doesn't work when function

2003-07-22 Thread Francisco Figueiredo Jr.
Nigel J. Andrews wrote:




Try returning an integer but returning a null for that integer...on the other
hand I see you're using sql as the language and I don't know how that would
work.
I tried that and it works. I changed the function body to do a query 
which returns null. The problem only appears if the return type is void.


Have you looked at plpgsql? Perhaps that is acceptable for you, in which case:

create function  funcF ( ) returns integer as '
 begin
   delete from blah;
   return null;
 end;
' as language 'plpgsql';
select * from funcF();

Yeap, it works, but you specified integer as the return type :)

I'd like to have the return type as void and be possible to call it with
select * from funcF();
Thanks Nigel.

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


[HACKERS] Why select * from function doesn't work when function has returntype void??

2003-07-22 Thread Francisco Figueiredo Jr.
Hi all,

I would like to know why does calling a function with select * from 
function doesn't work when its return type is set to void.

I'm asking this because I have a code which uses this syntax to add 
support for returning resultsets from functions. This way, regardless 
the function returns a resultset or a single value, I could do select * 
from function and it works very well.

The problem appears when the function has its returns type to void.
I get the following error message:
npgsql_tests=> select * from funcF();
ERROR:  function funcf() in FROM has unsupported return type
ERROR:  function funcf() in FROM has unsupported return type
where funcF is defined as:

npgsql_tests=> create function funcF() returns void as 'delete from 
tablea where field_serial > 5' language 'sql';

CREATE FUNCTION

But it does work if I call it as:

select funcF();



I'd like to know if would be possible to change this behaviour to return 
an empty result set with a null value. This way, there would be 
consistency in calling all functions regardless of its return type with 
select * from function.

Thanks in advance.

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


[HACKERS] Handling protocol not supported error message when working with protocol2 and 3

2003-07-12 Thread Francisco Figueiredo Jr.
Hi all,

I'm finishing the implementation of the protocol 3.0 and now I'm working 
in how to connect to server using protocol 3.0 when the server doesn't 
support it 7.3- .

As suggested in a previous mail about how to handle with both protocol 
versions, I'm trying first to connect using version 3.0. The problem is 
if the server is a 7.3 or earlier, it would answer with a non supported 
protocol error message, but as I'm in the protocol 3.0 version mode, I 
would expect a error message in the new format and not in the 2.0 format.

How I could handle it?

I know this error happens early in the connection establishment, when I 
send the StartupPacket and I could use this info to do some choices 
about when to use the version 2 or 3. The problem is that I also could 
get a lot of errors when sending the startup packet, as password 
incorrect, database and others.

I was thinking about examining the first 4 bytes ( as this is where the 
message length is located) and try if these bytes could be translated to 
"FATA" which would mean the "FATAL:  unsupported frontend protocol\n" 
error.  But I think this would be a big hack. Is there a more elegant 
solution?

I know this question was alread raised some time ago, but I couldn't 
find it.

Thanks in advance.

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [HACKERS] Transaction handling in extended query mode and Sync

2003-07-11 Thread Francisco Figueiredo Jr.
Carlos Guzman Alvarez wrote:
Hello:

Hello Carlos.

I continue to work in the implementation of the 3.0 protocol in C#, i'm 
making a test that consist on:

- Create a database.
- Create a table in the new database.
- Start transaction.
- Insert 100 rows of data in the new table.
- Commit transaction.
For start a transaction i send a Query message with this as statement text:

START TRANSACTION ISOLATION LEVEL READ COMMITTED

For commit a transaction i send a Query message with this as statement 
text:

COMMIT TRANSACTION

For execute the inserts i use parametrized commands with Extended query 
mode, sending this sequence of messages:

- Parse & Flush ( Only for the first command )
- Describe & Flush ( Only for the first command )
- Close Portal ( begining at second command )
- Bind & Flush
- Execute & Sync
But the Sync message seems to be commiting the transaction, if i send a 
Flush message all works as expected with inserts, but create database & 
table will not work.

Sorry for late response...
I could finally get Npgsql to talk protocol 3.0 version :) It is not 
100% but it is near...
I give it a try in a test similar to yours... I didn't send the create 
database commands just the row insertion.

in both sequences, I could get the desired behaviour.
I could send the begin transaction in simple query mode, send the insert 
in extended mode and send a commit or rollback in simple mode sending 
the sync message in the end of extended mode.

Are you still having problems with it?

I hope it helps.

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
 joining column's datatypes do not match


Re: [HACKERS] Receiving data in binary format how is it encoded?

2003-07-06 Thread Francisco Figueiredo Jr.
Carlos Guzman Alvarez wrote:

Hello:

Hello

Yeah, while waiting for the response, I added support for the int4 
datatype. It is really encoded as a 4 bytes value.


:)

Uhmmm, where did you take the 2000,1,1 as base from?
If the date is before 2000, days will have a negative value, so date 
is calculated correctly backwards?


In the little tests i do, yes.
Good. I think I found where you get 200,1,1 from:
In datetime.c in the AST dir, there is a line which says:
Assert(POSTGRES_EPOCH_JDATE == date2j(2000, 1, 1));



Thanks Carlos. do you know in what file are these values produced?


Not sure but i'm reviewing files in directory:

src\backend\utils\adt

This is what seems to be sent for numeric datatype i'm going to test it 
now :D:

pq_sendint(&buf, x.ndigits, sizeof(int16));
pq_sendint(&buf, x.weight, sizeof(int16));
pq_sendint(&buf, x.sign, sizeof(int16));
pq_sendint(&buf, x.dscale, sizeof(int16));
for (i = 0; i < x.ndigits; i++)
pq_sendint(&buf, x.digits[i], sizeof(NumericDigit));

Thanks. I will have a look in the types in the AST dir.

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] Receiving data in binary format how is it encoded?

2003-07-06 Thread Francisco Figueiredo Jr.
Carlos Guzman Alvarez wrote:

Hello:

while implementing the protocol 3.0 I could get the data in text mode 
setting the format to 0. (Thanks all for helping me out with flush 
message)

Now, I want to test the binary format. While some primitive types are 
easy to realize, for example a int4 field will be encoded in 4 bytes,
I don't know how other types, like date, time, timestamp, text will be 
encoded in binary format.


Huum i'm going to comment how i make in my C# implementation (stream 
is a binary reader ) for example for int4, date and time.

Thanks.

For int4:

int val = stream.ReadInt32();
int int4Value = IPAddress.HostToNetworkOrder(val);
Yeah, while waiting for the response, I added support for the int4 
datatype. It is really encoded as a 4 bytes value.


For date ( not sure if i'm making this correct way but values seems to 
be correct :) )

DateTime base = new DateTime(2000, 1, 1)
int val = stream.ReadInt32();
int days = IPAddress.HostToNetworkOrder(val);
DateTime date = base.AddDays(days);


Uhmmm, where did you take the 2000,1,1 as base from?
If the date is before 2000, days will have a negative value, so date is 
calculated correctly backwards?


For Time:

The same as for date but reading a double and adding it to base as 
seconds instead of days.



The only basic data type i'm not handling now is numeric that seems to 
be encoded in 10 bytes but i have no seen the postgre source code yet.


Thanks Carlos. do you know in what file are these values produced?





--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[HACKERS] Receiving data in binary format how is it encoded?

2003-07-06 Thread Francisco Figueiredo Jr.


Hi all,

while implementing the protocol 3.0 I could get the data in text mode 
setting the format to 0. (Thanks all for helping me out with flush message)

Now, I want to test the binary format. While some primitive types are 
easy to realize, for example a int4 field will be encoded in 4 bytes,
I don't know how other types, like date, time, timestamp, text will be 
encoded in binary format.

I tried to find in the code how it would be encoded, but I end up in 
some dinamically called functions to do the output and I don't know 
where this functions are defined.

Can you provide me some tips where the functions are or the binary 
format used to encode the types?

While writing this mail, I saw the docs about binary types... So, my 
assumption about int4 be encoded in 4 bytes may be wrong? I mean, the 
return of an int4 value, for example 12345 in text would be the chars 
12345, but in binary format would be the bytes of 1 2 3 4 5?? Instead of 
a 4 bytes int4 value?

The first 4 bytes of bytea is its length? I think I saw something about 
this in the code. So in the example below I would get a first 4 bytes 
containing the length (5) of the bytes?

Also, just question:
If I have a field which has binary type and I use the extended protocol 
to set all result fields to text, will this field also be sent in text, 
regardless its type?

Thanks in advance!



--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] Problem when running initdb with latest cvs code

2003-06-29 Thread Francisco Figueiredo Jr.
Andreas Pflug wrote:

Francisco Figueiredo Jr. wrote:



Hi all,
I'm getting the following error when trying to do an initdb:
This user must also own the server process.

initializing pg_depend... ERROR:  expression_tree_walker: Unexpected 
node type 601
IN:  expression_tree_walker (clauses.c:2320)

Hi Francisco,
I had the same problem. Perform a
  "make clean"
and then the normal "make; make install", and hopefully it will be 
solved just as it was on my machine.

Thanks. It worked!

Thank you too, Tom Lane.

Sorry for bothering you with this :) I will be more carefull next time.

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly


[HACKERS] Problem when running initdb with latest cvs code

2003-06-29 Thread Francisco Figueiredo Jr.


Hi all,
I'm getting the following error when trying to do an initdb:
This user must also own the server process.

The database cluster will be initialized with locale C.

Fixing permissions on existing directory /var/pgsqlcvs2... ok
creating directory /var/pgsqlcvs2/base... ok
creating directory /var/pgsqlcvs2/global... ok
creating directory /var/pgsqlcvs2/pg_xlog... ok
creating directory /var/pgsqlcvs2/pg_clog... ok
creating template1 database in /var/pgsqlcvs2/base/1... ok
creating configuration files... ok
initializing pg_shadow... ok
enabling unlimited row size for system tables... ok
initializing pg_depend... ERROR:  expression_tree_walker: Unexpected 
node type 601
IN:  expression_tree_walker (clauses.c:2320)

initdb failed.

Am I missing something??
I have a previous cvs version which works well.
I'm using cygwin on windows xp.

P.S.: btw, Tom Lane, your fixes for "super user name with spaces" 
problem are working very well. Thanks.

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [HACKERS] Getting blocked when receinving response from a Parse

2003-06-29 Thread Francisco Figueiredo Jr.
Carlos Guzman Alvarez wrote:
Hello:

Uhmmm, if you don't mind... are you implementing something like a data 
provider for Postgresql, or it is just an ad hoc program?


Well i start making a simple library for 3.0 protocol for curiosity only 
 :), the protocol have a great documentation, but after some some days i 
decide to try to make a Data Provider for protocol 3.0 only (I already 
have made a Data Provider for other RDMBMS :)),
That's very good!
Do you know about Npgsql?
Please, have a look at gborg.postgresql.org/project/npgsql.
It is a Postgresql .net data provider written 100% in C#.
Maybe you could give some tips, suggestions, improvements, bug fixes... :)
I'm right now implementing the extended query mode and as you and Tom 
Lane said, the Flush message worked very well. Thanks again.

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly


Re: [HACKERS] Getting blocked when receinving response from a Parse

2003-06-28 Thread Francisco Figueiredo Jr.
Carlos Guzman Alvarez wrote:

Hello:

 >You must send either Flush or Sync after the Parse to force the backend
 >to emit its response to Parse.  The assumption is that in many cases
 >you'll be sending Parse as part of a batch of commands, and the backend
 >should batch its responses to minimize the number of network packets
 >sent.  So you have to tell it where the batch boundaries are --- thus,
 >Flush or Sync.  See the docs concerning the difference between the two.


I have the same problem some days ago with the implementation of the 
version 3.0 protocol in C# and now using Flush it's working quite well :)


Thanks Carlos.

Uhmmm, if you don't mind... are you implementing something like a data 
provider for Postgresql, or it is just an ad hoc program?



--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly


Re: [HACKERS] Getting blocked when receinving response from a Parse

2003-06-28 Thread Francisco Figueiredo Jr.
Tom Lane wrote:
"Francisco Figueiredo Jr." <[EMAIL PROTECTED]> writes:

I'm implementing the 3.0 protocol version in Npgsql, a .Net Data 
provider for postgresql.


I stopped in the first message: Parse :(
I send the parse message but I don't receive the ParseComplete or the 
ErrorResponse. My code simply freezes while reading the byte from 
network stream.


You must send either Flush or Sync after the Parse to force the backend
to emit its response to Parse.  The assumption is that in many cases
you'll be sending Parse as part of a batch of commands, and the backend
should batch its responses to minimize the number of network packets
sent.  So you have to tell it where the batch boundaries are --- thus,
Flush or Sync.  See the docs concerning the difference between the two.
Oohh, thanks, Tom Lane!
I didn't read carefully the final part of extended query where it says 
about the Flush message :)

I didn't realize the idea of holding responses to minimize network 
traffic. I was thinking in the send reply style :)

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[HACKERS] Getting blocked when receinving response from a Parse message...

2003-06-27 Thread Francisco Figueiredo Jr.


Hi all,

I'm playing with this for one week with no luck... :(

I'm implementing the 3.0 protocol version in Npgsql, a .Net Data 
provider for postgresql.

I could get it working using the simple query and so, I started to work 
in the extended query.

I stopped in the first message: Parse :(

I send the parse message but I don't receive the ParseComplete or the 
ErrorResponse. My code simply freezes while reading the byte from 
network stream.

I added some elog lines to check that I was sending the message 
correctly. I could even check that pq_putemptymessage('1') is being 
called in the exec_parse_message() method, but I don't know why I'm 
getting blocked when reading the data.

It is strange because all the simple query mode tests I did work very 
well. Just this Parse message isn't working for me.

Am I missing something?

I'm using the latest cvs code on cygwin.

Thanks in advance.



--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [HACKERS] Fields float4 don't return any row when selecting a

2003-06-18 Thread Francisco Figueiredo Jr.
Bruno Wolff III wrote:

On Tue, Jun 17, 2003 at 23:26:07 -0300,
  "Francisco Figueiredo Jr." <[EMAIL PROTECTED]> wrote:
Hi all,
I'm using the 7.4 cvs version on cygwin and I noticed that if I have a 
table with a field of float4 type and try to do a simple select:
select * from table where field_float4 = 4.4

it doesn't return any rows.
In the same table I have a float8 field and it works ok.
If I try with a value without the . in the float4 field it also works.


I believe that is because the constant 4.4 is originally a float 8 value
and the comparison to the float4 value is done by promoting to float8.
And the nearest float4 value to 4.4 is not the same as the nearest
float8 value to 4.4. I think both quoting the 4.4 or casting it to
float4 will solve your problem.

Note that under many circumstances equality tests between floating
values doesn't make a lot of sense. If you really want to do this,
you might want to consider using the numeric type.


Thanks!! I will use the quoting, as it could be used with both float4 
and float8 values.

--
Regards,
Francisco Figueiredo Jr.
---
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
 joining column's datatypes do not match


[HACKERS] Fields float4 don't return any row when selecting a value with a.

2003-06-17 Thread Francisco Figueiredo Jr.


Hi all,
I'm using the 7.4 cvs version on cygwin and I noticed that if I have a 
table with a field of float4 type and try to do a simple select:
select * from table where field_float4 = 4.4

it doesn't return any rows.
In the same table I have a float8 field and it works ok.
If I try with a value without the . in the float4 field it also works.

The only way I could get the field_float4 to work was to add '' in the 
value.

Summary of results:
Table created as: create table tableD(field_float4 float4, field_float8 
float8);

insert into tableD values (3.3, 4.4);
insert into tableD values (4, 3);
select * from tableD where field_float4 = 3.3 ==> 0 rows returned
select * from tableD where field_float8 = 4.4 --> 1 row returned.
select * from tableD where field_float4 = '3.3' ==> 1 row returned.
Can someone confirm that for me?
Thanks in advance.


--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[HACKERS] initdb problems handling super username with spaces.

2003-06-02 Thread Francisco Figueiredo Jr.
Hi all,
I just get postgresql from cvs and could compile perfectly on cygwin!!
Great work guys!!!
But when I run the initdb script, it fails with the following message:

The database cluster will be initialized with locale C.

Fixing permissions on existing directory /var/pgsqlcvs/... ok
creating directory /var/pgsqlcvs//base... ok
creating directory /var/pgsqlcvs//global... ok
creating directory /var/pgsqlcvs//pg_xlog... ok
creating directory /var/pgsqlcvs//pg_clog... ok
creating template1 database in /var/pgsqlcvs//base/1... ok
creating configuration files... ok
initializing pg_shadow... ok
enabling unlimited row size for system tables... ok
initializing pg_depend... ok
creating system views... ok
loading pg_description... ok
creating conversions... ok
setting privileges on built-in objects... ERROR:  user "Francisco" does 
not exis
t
IN:  get_usesysid (lsyscache.c:1737)

initdb failed.

I'm running with an account name "Francisco Figueiredo"

I know this can't be a major issue, but I just wanted let you know.
I could easily workaround by passing a "non-spaced" name as the super 
user with the -U option.

psql also seems to be with problems as it says it can't find PQFreemem 
in the pq.dll

But I could use the psql from the 7.3.2 release :)

Again, great work guys!

--
Regards,
Francisco Figueiredo Jr.

--
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [HACKERS] [Npgsql-general] Get function OID and function calling support

2003-01-07 Thread Francisco Figueiredo Jr.
--- Tom Lane <[EMAIL PROTECTED]> escreveu: 
> "Dave Page" <[EMAIL PROTECTED]> writes:
> > Sorry, don't know. Can anyone on pgsql-hackers tell us the purpose of
> > the FunctionCall message?
> 
> It's used to invoke the "fast path" function call code
> (src/backend/tcop/fastpath.c).  libpq's large-object routines use this,
> but little else does AFAIK.  The current protocol is sufficiently broken
> (see comments in fastpath.c) that I'd not really encourage people to use
> it until we can fix it --- hopefully that will happen in 7.4.

Ok, as Kristis already said about how functions are being commonly called, I
will implement it this way: transforming the function call into a "select
" statement. I already have some working code and I will clean
it and commit it soon.

Thanks all!


=
Regards,
Francisco Figueiredo Jr.

___
Busca Yahoo!
O melhor lugar para encontrar tudo o que você procura na Internet
http://br.busca.yahoo.com/

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html