Re: [GENERAL] event triggers in 9.3.4

2014-07-24 Thread hubert depesz lubaczewski
On Thu, Jul 24, 2014 at 2:22 AM, Vasudevan, Ramya < ramya.vasude...@classmates.com> wrote: > CREATE TABLE log_ddl_info(ddl_tag text, ddl_event text, ddl_time > timestamp); > > CREATE OR REPLACE FUNCTION log_ddl_execution() > > RETURNS event_trigger AS $$ > > DECLARE > > insertquery TEXT; > > BEGI

Re: [GENERAL] Table checksum proposal

2014-07-24 Thread hubert depesz lubaczewski
On Thu, Jul 24, 2014 at 3:35 AM, wrote: > I have a suggestion for a table checksumming facility within PostgreSQL. > The applications are reasonably obvious - detecting changes to tables, > validating data migrations, unit testing etc. A possible algorithm is as > follows: > > 1. For each row of

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Adrian Klaver
On 07/24/2014 05:54 AM, Ramesh T wrote: CREATE OR REPLACE TYPE t_varchar2_tab AS TABLE OF VARCHAR2(4000); / CREATE OR REPLACE FUNCTION tab_to_string (p_varchar2_tab IN t_varchar2_tab, p_delimiter IN VARCHAR2 DEFAULT ',') RETURN V

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Adrian Klaver
On 07/24/2014 05:54 AM, Ramesh T wrote: i need this one please let me know.. thanks in advance , Previous post would have been better with the link :( http://stackoverflow.com/questions/43870/how-to-concatenate-strings-of-a-string-field-in-a-postgresql-group-by-query ramesh -- Adrian

Re: [GENERAL] Table checksum proposal

2014-07-24 Thread matt
> On Thu, Jul 24, 2014 at 3:35 AM, wrote: > >> I have a suggestion for a table checksumming facility within PostgreSQL. >> The applications are reasonably obvious - detecting changes to tables, >> validating data migrations, unit testing etc. A possible algorithm is >> as >> follows: >> >> 1. For

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Adrian Klaver
On 07/24/2014 07:03 AM, Ramesh T wrote: HI, when i use string_agg function it returns string_agg(bigint) does'nt exist. when "array_string" function it's return can't convert bigint to the t_varchar2_tab. i have questiont_varcha2_tab type is available on

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Adrian Klaver
On 07/24/2014 07:11 AM, Ramesh T wrote: hi , i looked into that link ,when i run string_agg does not exist returns ,But i'm using function here not paasing table to the function only i'm passing column name and delimiter to the function from select statement please look into the my first post..

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Adrian Klaver
On 07/24/2014 07:22 AM, Ramesh T wrote: SELECT qa.tab_to_largestringcheck(cast(array_agg(part_id)as t_varchar2_tab),':')FROM qa.part when i replace string_agg it's return does not exit, My guess is if you look at the error message it is complaining about the type of argument passed in. Plea

Re: [GENERAL] Standby Server Bus 7 error

2014-07-24 Thread Kevin Grittner
Michael Paquier wrote: > On Thu, Jul 24, 2014 at 12:53 PM, Fabio Milano >> 2014-07-23 14:47:56 EDT LOG:  startup process (PID 730)    terminated by >> signal 7: Bus error > This may find its root to a hardware problem... ... or a VM bug, which is the most frequent cause I have seen. -- K

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Adrian Klaver
On 07/24/2014 07:46 AM, Ramesh T wrote: i ran the \df string_agg is their but retuns like ERROR: function string_agg(character varying) does not exist LINE 2: qa.tab_to_largestringcheck(cast(string_agg(part_num)as t_var... ^ HINT: No function matches th

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Adrian Klaver
On 07/24/2014 07:46 AM, Ramesh T wrote: i ran the \df string_agg is their but retuns like ERROR: function string_agg(character varying) does not exist LINE 2: qa.tab_to_largestringcheck(cast(string_agg(part_num)as t_var... I should have explained what is going on here. If you do: production

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Ramesh T
CREATE OR REPLACE TYPE t_varchar2_tab AS TABLE OF VARCHAR2(4000); / CREATE OR REPLACE FUNCTION tab_to_string (p_varchar2_tab IN t_varchar2_tab, p_delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2 IS l_string VARCHAR2(32767);

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Ramesh T
SELECT qa.tab_to_largestringcheck(cast(array_agg(part_id)as t_varchar2_tab),':')FROM qa.part when i replace string_agg it's return does not exit, need to enable string_agg ..?i think is predefined right On Thu, Jul 24, 2014 at 7:47 PM, Ramesh T wrote: > postgres 9.3 > > > On Thu, Jul 24,

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Ramesh T
SELECT tab_to_largestring(cast(array_agg(dhar_id)as t_varchar2_tab),':')FROM qa.dhar when i run above statement it's return can't convert bigint to the t_varchar2_tab for the above function,i think problem at the t_varchar2_tab .. please any help..?runs on postgres 9.3 thanks in advance, ramesh

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Ramesh T
HI, when i use string_agg function it returns string_agg(bigint) does'nt exist. when "array_string" function it's return can't convert bigint to the t_varchar2_tab. i have questiont_varcha2_tab type is available on postgres 9.3..? i need it please let me kno

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Ramesh T
i ran the \df string_agg is their but retuns like ERROR: function string_agg(character varying) does not exist LINE 2: qa.tab_to_largestringcheck(cast(string_agg(part_num)as t_var... ^ HINT: No function matches the given name and argument types. You might

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Ramesh T
I have try select string_agg(partname,':') from part_tab;its return same, ERROR: function string_agg(bigint, unknown) does not exist LINE 1: select string_agg(part_id,':') from part; ^ HINT: No function matches the given name and argument types. You might need to add explicit

Re: [GENERAL] Referencing serial col's sequence for insert

2014-07-24 Thread Francisco Olarte
Hi Anil: On Wed, Jul 23, 2014 at 11:34 PM, Anil Menon wrote: ... > . It's that itch to drink deep from the fountain of knowledge. Beware of hyponatremia, and keep in mind it can change in the future. But you'll surely learn a lot. > I really do like > Laurenz Albe's advice of using WITH() AS w

Re: [GENERAL] tab_to_sting

2014-07-24 Thread Adrian Klaver
On 07/24/2014 08:03 AM, Ramesh T wrote: I have try select string_agg(partname,':') from part_tab;its return same, ERROR: function string_agg(bigint, unknown) does not exist LINE 1: select string_agg(part_id,':') from part; Try: select string_agg(part_id::text,':') from part;

Re: [GENERAL] event triggers in 9.3.4

2014-07-24 Thread Vasudevan, Ramya
>> You could compare list of tables before (_start) and after (_end) the ddl. >> Doing it in plpgsql will be tricky, but if you'd use some other language - >> like plperl - it's relatively simple: >> http://www.depesz.com/2013/12/18/waiting-for-9-4-plperl-add-event-trigger-support/ Thank You De

[GENERAL] Are queries run completely before a Cursor can be used?

2014-07-24 Thread Seref Arikan
Greetings, The documentation for Cursors at http://www.postgresql.org/docs/9.2/static/plpgsql-cursors.html says that: "Rather than executing a whole query at once, it is possible to set up a *cursor* that encapsulates the query, and then read the query result a few rows at a time. One reason for d

Re: [GENERAL] Are queries run completely before a Cursor can be used?

2014-07-24 Thread Tom Lane
Seref Arikan writes: > The documentation for Cursors at > http://www.postgresql.org/docs/9.2/static/plpgsql-cursors.html says that: > "Rather than executing a whole query at once, it is possible to set up a > *cursor* that encapsulates the query, and then read the query result a few > rows at a ti

Re: [GENERAL] Are queries run completely before a Cursor can be used?

2014-07-24 Thread Seref Arikan
Thanks Tom, Truly fascinating! Here I am, looking at a quite large query plan and thinking that postgres will partially run this is truly amazing. By any chance, can you name any text that covers this topic? Book, web site, document, anything would be fine, even non-postgres discussion of the topic

[GENERAL] copy/dump database to text/csv files

2014-07-24 Thread William Nolf
This is probably an easy one for most sql users but I don't use it very often. We have a postgres database that was used for an application we no longer use. However, we would like to copy/dump the tables to files, text or csv so we can post them to sharepoint. Copy seems to be what I wan

Re: [GENERAL] copy/dump database to text/csv files

2014-07-24 Thread John R Pierce
On 7/24/2014 12:04 PM, William Nolf wrote: This is probably an easy one for most sql users but I don't use it very often. We have a postgres database that was used for an application we no longer use. However, we would like to copy/dump the tables to files, text or csv so we can post them

Re: [GENERAL] copy/dump database to text/csv files

2014-07-24 Thread Thomas Kellerer
William Nolf wrote on 24.07.2014 21:04: This is probably an easy one for most sql users but I don't use it very often. We have a postgres database that was used for an application we no longer use. However, we would like to copy/dump the tables to files, text or csv so we can post them to shar

Re: System shutdown signal on Windows (was Re: [GENERAL])

2014-07-24 Thread Krystian Bigaj
On 24 July 2014 07:51, Kalai R wrote: > Thank You so much Krystian Bigaj. > > Since last 2 years I had suffering this problem. But today I got solution > from you. > I am developing .Net application with Postgres. > I am using WCF service (host as windows service) to connect postgres > database.

Re: [GENERAL] Standby Server Bus 7 error

2014-07-24 Thread Fabio Milano
-Original Message- From: Michael Paquier [mailto:michael.paqu...@gmail.com] Sent: Wednesday, July 23, 2014 10:25 PM To: Fabio Milano Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Standby Server Bus 7 error On Thu, Jul 24, 2014 at 12:53 PM, Fabio Milano wrote: > Any assistance

Re: [GENERAL] Standby Server Bus 7 error

2014-07-24 Thread Fabio Milano
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Fabio Milano Sent: Thursday, July 24, 2014 12:40 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] Standby Server Bus 7 error -Original Message- From:

Re: [GENERAL] Table checksum proposal

2014-07-24 Thread Karsten Hilbert
On Thu, Jul 24, 2014 at 01:43:29PM +0200, hubert depesz lubaczewski wrote: > > 1. Should this be a contrib module which provides a function, or should it > > be a built-in piece of functionality? > > 2. Is MD5 too heavyweight for this? Would using a non-cryptographic > > checksum be worth the spe

Re: [GENERAL] Table checksum proposal

2014-07-24 Thread Karsten Hilbert
On Thu, Jul 24, 2014 at 03:06:28PM +0100, m...@byrney.com wrote: > > select md5(string_agg(md5(c::text), '' order by md5(c::text))) from > > pg_class c; > > > > (of course you can do it on any table, not only pg_class). > > > > If you want to use the xor idea (which make sense), all you need is to

[GENERAL] Regular expression question with Postgres

2014-07-24 Thread Mike Christensen
I'm curious why this query returns 0: SELECT 'AAA' ~ '^A{,4}$' Yet, this query returns 1: SELECT 'AAA' ~ '^A{0,4}$' Is this a bug with the regular expression engine?

Re: [GENERAL] Regular expression question with Postgres

2014-07-24 Thread David G Johnston
Mike Christensen-2 wrote > I'm curious why this query returns 0: > > SELECT 'AAA' ~ '^A{,4}$' > > Yet, this query returns 1: > > SELECT 'AAA' ~ '^A{0,4}$' > > Is this a bug with the regular expression engine? Apparently since "{,#}" is not a valid regexp expression the engine simply interprets

Re: [GENERAL] Regular expression question with Postgres

2014-07-24 Thread Mike Christensen
Yea seems right. I was testing the expression on Rubular (Which uses the Ruby parser) and it worked. I guess Ruby allows this non-standard expression with the missing lower bounds. Every reference I could find, though, agrees only the upper bound is optional. On Thu, Jul 24, 2014 at 1:42 PM, D

Re: [GENERAL] Regular expression question with Postgres

2014-07-24 Thread Tom Lane
Mike Christensen writes: > I'm curious why this query returns 0: > SELECT 'AAA' ~ '^A{,4}$' > Yet, this query returns 1: > SELECT 'AAA' ~ '^A{0,4}$' > Is this a bug with the regular expression engine? Our regex documentation lists the following variants of bounds syntax: {m} {m,} {

Re: [GENERAL] Regular expression question with Postgres

2014-07-24 Thread Mike Christensen
Yea looks like Postgres has it right, well.. per POSIX standard anyway. JavaScript also has it right, as does Python and .NET. Ruby is just weird. On Thu, Jul 24, 2014 at 1:57 PM, Tom Lane wrote: > Mike Christensen writes: > > I'm curious why this query returns 0: > > SELECT 'AAA' ~ '^A{,4}$