Re: [GENERAL] How to include Tablefunc as an extension

2012-06-20 Thread Stefan Schwarzer
I read through the Postgres doc and many Google results, but it seems still unclear to me how to include additional packages into my postgres database. I see that there are a few installed under "/usr/local/pgsql-9.1/share/extension/" (I am on Lion and installed the Kyngcha

[GENERAL] Output of query_to_xml

2012-06-20 Thread P. Broennimann
Hi there In my stored function I use: select query_to_xml('select * from table12', true, true, '') into ... The result is OK but there is always an empty line: http://www.w3.org/2001/XMLSchema-instance";> *<-- Empty line here* FG8976SDFRETG NL 2011-02-28

Re: [GENERAL] Error message "psql: could not connect to server: No such file or directory"

2012-06-20 Thread Stefan Schwarzer
>> I need unfortunately to come back to this issue. I (again) re-installed Lion >> from scratch, and finally got everything working. The Postgres was running, >> I uploaded a couple of dumped SQL files. And then re-started the machine for >> another reason. And suddenly it says again the it can

Re: [GENERAL] Is it possible to send data in client end?

2012-06-20 Thread John R Pierce
On 06/20/12 9:13 PM, AI Rumman wrote: I am using Postgresql 9.1. I know that COPY is used to export data as csv. But COPY creates file in server end. I need to create a file in client end. My application uses php. Is there any tool for it? use COPY blahblah TO STDOUT; in php, you can use pg

[GENERAL] Is it possible to send data in client end?

2012-06-20 Thread AI Rumman
I am using Postgresql 9.1. I know that COPY is used to export data as csv. But COPY creates file in server end. I need to create a file in client end. My application uses php. Is there any tool for it?

Re: [GENERAL] RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION

2012-06-20 Thread utsav
merlin can u please suggest any solution for achiving this . I have tried array but still i am not getting how to return different array and for returning array i must have to pass one array in input parameter and that only i can return that is where i got stuck . Thanks -- View this message in c

Re: [GENERAL] 32-bit libpq with 64-bit server

2012-06-20 Thread Craig Ringer
On 06/20/2012 11:07 PM, Marc Watson wrote: Hello all, On Windows, I have a 32-bit client application that uses the 32-bit libpq.dll. In testing the client application with a Postgres 9.2 64-bit server I've noticed no problems, and was wondering if anyone knows of any caveats in this -- AFAIC

Re: [GENERAL] Simple method to format a string?

2012-06-20 Thread Emi Lu
select trim(regexp_replace('123456', '...', '\& ', 'g')); If you don't care about trailing space remove the 'trim()'. The replacement string may need to be escaped differently depending on your PG version and setting for standard_conforming_strings. For example: E'\\& ' After combined

Re: [GENERAL] RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION

2012-06-20 Thread Merlin Moncure
On Wed, Jun 20, 2012 at 12:15 PM, utsav wrote: > Ya but when i use the return next it gives me all OUT parameters but i will > get last record of out parameter1 repetitive untill the last record of last > out parameter . Sorry i didn't have output with me . Is there any other way > to achive this

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Thomas Kellerer
Alan Hodgson wrote on 20.06.2012 19:39: I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%' How efficient is it if that's the only search criteria against a large table? how much does indexing the column help and roughly how much more space is needed for the index? Indexin

Re: [GENERAL] Simple method to format a string?

2012-06-20 Thread Bosco Rama
Emi Lu wrote: > Good morning, > > Is there a simply method in psql to format a string? > > For example, adding a space to every three consecutive letters: > > abcdefgh -> *** *** *** Depending on how you want 'extras' handled, you could work from something like this: select trim(regexp_repl

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Edson Richter
Em 20/06/2012 15:03, John R Pierce escreveu: On 06/20/12 10:37 AM, Edson Richter wrote: select * from tb1 where nome like 'CARLOS%' or reverse(nome) like reverse('%CARLOS') Should return same results as select * from tb1 where nome like '%CARLOS%' no, that won't match 'abcCARLOSxyx'

Re: [GENERAL] How to determine to which version of PostgreSQL a patch was applied

2012-06-20 Thread hubert depesz lubaczewski
On Wed, Jun 20, 2012 at 02:45:16PM -0300, Norberto Dellê wrote: > Hi all > > I would like to determine to which version of PostgreSQL a certain patch > was applied. > I'm having trouble with a message flooding my log files and possibly > affecting the server > performance, and I found a patch that

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread John R Pierce
On 06/20/12 10:37 AM, Edson Richter wrote: select * from tb1 where nome like 'CARLOS%' or reverse(nome) like reverse('%CARLOS') Should return same results as select * from tb1 where nome like '%CARLOS%' no, that won't match 'abcCARLOSxyx' -- john r pierceN 3

Re: [GENERAL] Simple method to format a string?

2012-06-20 Thread Andy Colson
On 6/20/2012 12:59 PM, Scott Marlowe wrote: This pretty much calls for a user defined function. Plpgsql should work, but if you're more comfy in perl or tcl there's pl/tcl and pl/perl you can try as well. On Wed, Jun 20, 2012 at 8:43 AM, Emi Lu wrote: Good morning, Is there a simply method i

Re: [GENERAL] Simple method to format a string?

2012-06-20 Thread Scott Marlowe
This pretty much calls for a user defined function. Plpgsql should work, but if you're more comfy in perl or tcl there's pl/tcl and pl/perl you can try as well. On Wed, Jun 20, 2012 at 8:43 AM, Emi Lu wrote: > Good morning, > > Is there a simply method in psql to format a string? > > For example

Re: [GENERAL] How to create c language in postgresql database. Thanks.

2012-06-20 Thread yxj
Hi Albe, Thanks. I will study it. Regards. Grace At 2012-06-14 15:33:07,"Albe Laurenz" wrote: >leaf_yxj wrote: >> Thanks for your answers. I really appreciate it. Although I don't >understand the whole things you guys >> mentioned to me. I think maybe I should do it by myself. I need to

[GENERAL] How to determine to which version of PostgreSQL a patch was applied

2012-06-20 Thread Norberto Dellê
Hi all I would like to determine to which version of PostgreSQL a certain patch was applied. I'm having trouble with a message flooding my log files and possibly affecting the server performance, and I found a patch that may shed some light over the problem: http://git.postgresql.org/gitweb/?p=pos

Re: [GENERAL] Simple method to format a string?

2012-06-20 Thread Ben Chobot
On Jun 20, 2012, at 7:43 AM, Emi Lu wrote: > Good morning, > > Is there a simply method in psql to format a string? > > For example, adding a space to every three consecutive letters: > > abcdefgh -> *** *** *** > > Thanks a lot! > Emi I'm unaware of such a function (it seems like a generic f

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Thomas Kellerer
Sam Z J wrote on 20.06.2012 19:10: Hi all I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%' How efficient is it if that's the only search criteria against a large table? how much does indexing the column help and roughly how much more space is needed for the index? if t

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Sam Z J
thank you all for the useful information =D On Wed, Jun 20, 2012 at 1:39 PM, Alan Hodgson wrote: > On Wednesday, June 20, 2012 01:10:03 PM Sam Z J wrote: > > Hi all > > > > I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%' > > How efficient is it if that's the only search

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Alan Hodgson
On Wednesday, June 20, 2012 01:10:03 PM Sam Z J wrote: > Hi all > > I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%' > How efficient is it if that's the only search criteria against a large > table? how much does indexing the column help and roughly how much more > space is

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Edson Richter
Just ocurred to me that would be possible to create some sort of "hybrid" solution... create index idx1 on tb1 (nome); create index idx2 on tb1 (reverse(nome)); select * from tb1 where nome like 'CARLOS%' or reverse(nome) like reverse('%CARLOS') Should return same results as select * from tb

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Edson Richter
AFAIK, wildcards at both ends are not optimized at all, unless you use some sort of specialized index (may be Gist or FullText). Until 9.1 there is no such "Index Scan" feature, that would help (very little). Other databases (like MS SQL Server) solve this kind of query by executing an Index Sca

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Andy Colson
On 6/20/2012 12:10 PM, Sam Z J wrote: Hi all I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%' How efficient is it if that's the only search criteria against a large table? how much does indexing the column help and roughly how much more space is needed for the index? if

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Lonni J Friedman
On Wed, Jun 20, 2012 at 10:10 AM, Sam Z J wrote: > Hi all > > I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%' > How efficient is it if that's the only search criteria against a large > table? how much does indexing the column help and roughly how much more > space is neede

Re: [GENERAL] RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION

2012-06-20 Thread utsav
Ya but when i use the return next it gives me all OUT parameters but i will get last record of out parameter1 repetitive untill the last record of last out parameter . Sorry i didn't have output with me . Is there any other way to achive this ? Many Thanks for your help merlin ... -- View this

[GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Sam Z J
Hi all I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%' How efficient is it if that's the only search criteria against a large table? how much does indexing the column help and roughly how much more space is needed for the index? if the answers are too long, please point m

Re: [GENERAL] 32-bit libpq with 64-bit server

2012-06-20 Thread Merlin Moncure
On Wed, Jun 20, 2012 at 10:07 AM, Marc Watson wrote: > Hello all, > > On Windows, I have a 32-bit client application that uses the 32-bit > libpq.dll. In testing the client application with a Postgres 9.2 64-bit > server I’ve noticed no problems, and was wondering if anyone knows of any > caveats

[GENERAL] 32-bit libpq with 64-bit server

2012-06-20 Thread Marc Watson
Hello all, On Windows, I have a 32-bit client application that uses the 32-bit libpq.dll. In testing the client application with a Postgres 9.2 64-bit server I've noticed no problems, and was wondering if anyone knows of any caveats in this - AFAICS the tcp communication is between the 32-bit libp

Re: [GENERAL] db server processes hanging around

2012-06-20 Thread Edson Richter
Em 20/06/2012 04:53, Sumit Raja escreveu: Or ask your Java devs to investigate why the shut down does not close the physical connection properly. Does IDEA claim to shut down Tomcat but actually it is still running because of a threads not being cleaned up? Are you sure this isn't happening duri

Re: [GENERAL] RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION

2012-06-20 Thread Merlin Moncure
On Wed, Jun 20, 2012 at 5:31 AM, utsav wrote: > CREATE OR REPLACE FUNCTION "morse_new_sit"."proc_get_freq_svrty_array1"(IN > ip_dim_type bigint, IN ip_type bigint, IN ip_frqsubype bigint, IN > ip_svrsubtype bigint , > --, >  op_dimlist OUT  morse_new_sit.user_fs_obj[],op_freqlist OUT > morse_new_s

Re: [GENERAL] Feature discussion: Should syntax errors abort a transaction?

2012-06-20 Thread Edson Richter
Em 20/06/2012 11:00, fe...@crowfix.com escreveu: On Wed, Jun 20, 2012 at 06:36:09AM -0700, fe...@crowfix.com wrote: On Tue, Jun 19, 2012 at 11:25:24AM -0600, Scott Marlowe wrote: On Tue, Jun 19, 2012 at 8:50 AM, Edson Richter wrote: There is also the case of dynamically generated sql statemen

[GENERAL] Simple method to format a string?

2012-06-20 Thread Emi Lu
Good morning, Is there a simply method in psql to format a string? For example, adding a space to every three consecutive letters: abcdefgh -> *** *** *** Thanks a lot! Emi -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.p

Re: [GENERAL] pgstat wait timeout : permission denied

2012-06-20 Thread Craig Ringer
On 06/20/2012 08:31 PM, pandorino wrote: Hi all just to close the post and let you know: it was the antivirus (McAfee). Now I have to see how to create an exception on this folder, because of course I would keep the antivirus running. You'll probably also want to set an exception on the folder

Re: [GENERAL] Feature discussion: Should syntax errors abort a transaction?

2012-06-20 Thread felix
On Wed, Jun 20, 2012 at 06:36:09AM -0700, fe...@crowfix.com wrote: > On Tue, Jun 19, 2012 at 11:25:24AM -0600, Scott Marlowe wrote: > > On Tue, Jun 19, 2012 at 8:50 AM, Edson Richter > > wrote: > > > There is also the case of dynamically generated sql statements based on > > > user selection...

[GENERAL] error handling

2012-06-20 Thread Little, Douglas
Hello, Greenplum 4.1.2.4 (PG 8.2.3) We are revising how we implement functions in order to better capture and handle fatal errors. What we want to have happen, 1. is to have the fatal error captured, 2. logged to our processing table, 3. then have the function & psql exit wi

Re: [GENERAL] Feature discussion: Should syntax errors abort a transaction?

2012-06-20 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Simon Riggs wrote: > So it would be useful to have a non-default option of > statement-level abort for those cases, as an ease of use feature. I think you misspelled "foot gun"

Re: [GENERAL] Feature discussion: Should syntax errors abort a transaction?

2012-06-20 Thread felix
On Tue, Jun 19, 2012 at 11:25:24AM -0600, Scott Marlowe wrote: > On Tue, Jun 19, 2012 at 8:50 AM, Edson Richter > wrote: > > There is also the case of dynamically generated sql statements based on > > user selection... being syntax or not, I would never want half job done. > > Thia is the purpo

Re: [GENERAL] Please make it easy to drop a database that is in use

2012-06-20 Thread Sergey Konoplev
On Tue, Jun 19, 2012 at 1:40 PM, Evan Martin wrote: > When I'm developing against a PostgreSQL database I often drop and re-create > it and I often find that the drop fails, because it's "in use by other > users". This is really annoying, especially when I know full well there are > no other users

Re: [GENERAL] pgstat wait timeout : permission denied

2012-06-20 Thread pandorino
Hi all just to close the post and let you know: it was the antivirus (McAfee). Now I have to see how to create an exception on this folder, because of course I would keep the antivirus running. Thanks Alban for the hint. Regards -- View this message in context: http://postgresql.1045698.n5.nab

Re: [GENERAL] Finding all 8.4->9.x incompatible PL/pgSQL functions with conflicting parameter/column names causing "column reference ... is ambiguous" errors

2012-06-20 Thread Pavel Stehule
2012/6/20 Joel Jacobson : > I'm upgrading from 8.4 to 9.1, and have a lot of PL/pgSQL functions which > works in 8.4, but when called, throws an error in 9.1. > > Example: > > CREATE TABLE mytable (id serial not null primary key, value text); > > INSERT INTO mytable (id, value) VALUES (1, 'foo'); >

[GENERAL] Finding all 8.4->9.x incompatible PL/pgSQL functions with conflicting parameter/column names causing "column reference ... is ambiguous" errors

2012-06-20 Thread Joel Jacobson
I'm upgrading from 8.4 to 9.1, and have a lot of PL/pgSQL functions which works in 8.4, but when called, throws an error in 9.1. Example: CREATE TABLE mytable (id serial not null primary key, value text); INSERT INTO mytable (id, value) VALUES (1, 'foo'); INSERT INTO mytable (id, value) VALUES (

Re: [GENERAL] RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION

2012-06-20 Thread utsav
CREATE OR REPLACE FUNCTION "morse_new_sit"."proc_get_freq_svrty_array1"(IN ip_dim_type bigint, IN ip_type bigint, IN ip_frqsubype bigint, IN ip_svrsubtype bigint , --, op_dimlist OUT morse_new_sit.user_fs_obj[],op_freqlist OUT morse_new_sit.user_fs_obj[],op_svrlist OUT morse_new_sit.user_fs_obj

Re: [GENERAL] How to get no. of commits/rollbacks by application on the database?

2012-06-20 Thread Raghavendra
> This sounds like one of those "what are you trying to achieve" questions, > where you need to step back and ask why you're trying to collect that info > and what you want it for. > > First, how do you define "application"? Any client that connects to a > given database? Any client that sets the a

[GENERAL] View parsing

2012-06-20 Thread Dr. F. Lee
Hi all, I would like to be able to determine which tables each field of a view comes from. I have a view definition like SELECT tbl_a.fld_a, tbl_b.fld_b AS fld_e, function(c,d,f) as fld_c, (SELECT fld_d FROM tbl_d WHERE tbl_d.fld_e=tbl_a.fld_a) as fld_d FROM tbl_a inner join tbl_b on tbl_a.

Re: [GENERAL] Feature discussion: Should syntax errors abort a transaction?

2012-06-20 Thread Rafal Pietrak
On Wed, 2012-06-20 at 00:24 -0700, Chris Travers wrote: [--] > > I guess it seems to me that I would not object to a new option for > transaction behavior where one could do something like SET TRANSACTION > INTERACTIVE; and have no errors abort the transaction at all (explicit > co

Re: [GENERAL] db server processes hanging around

2012-06-20 Thread Sumit Raja
Or ask your Java devs to investigate why the shut down does not close the physical connection properly. Does IDEA claim to shut down Tomcat but actually it is still running because of a threads not being cleaned up? Are you sure this isn't happening during normal operation of the application? If i

Re: [GENERAL] Feature discussion: Should syntax errors abort a transaction?

2012-06-20 Thread Philip Couling
On 20/06/2012 08:24, Chris Travers wrote: > It seems to me there is one very simple reason not to change current > behavior which those in favor are glossing over. > > Most interactions with a database are not occurring over an interface > like psql with one person typing on one side and the db ex

Re: [GENERAL] Feature discussion: Should syntax errors abort a transaction?

2012-06-20 Thread Chris Travers
It seems to me there is one very simple reason not to change current behavior which those in favor are glossing over. Most interactions with a database are not occurring over an interface like psql with one person typing on one side and the db executing on the other.If that were the case I wou