Re: [GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-28 Thread Andreas Kretschmer
Susan Hurst wrote: > h...well, Tom, at least you saved me a lot of frustration with > trying to get this to work :-) For the time being, I'll just follow up > DDL activity with a procedure that compares diffs between > information_schema and the history tables. If and when pl/pgsql of

Re: [GENERAL] Options for complex materialized views sharing most of the same logic?

2015-12-28 Thread Francisco Olarte
On Sun, Dec 27, 2015 at 10:39 PM, Wells Oliver wrote: > I have one view which totals about 60 columns per day. Each day has a "days > ago" column like so: . > Each of these views is basically a copy of one another for 99% of the code > (the summing, percentages, etc). The only differences are:

Re: [GENERAL] grep -f keyword data query

2015-12-28 Thread Tom Lane
Hiroyuki Sato writes: > I re-created index with pg_trgm. > Execution time is 210sec. > Yes It is faster than btree index. But still slow. > It is possible to improve this query speed? > Should I use another query or idex? Did you try a GIN index? regards, tom lane -- S

[GENERAL] Regex help again (sorry, I am bad at these)

2015-12-28 Thread Christopher Molnar
Sorry to have to ask the experts here for some regex assistance again. I am admittadly awful with these and could use some help. Have the following string (this is an example) that needs to be changed. Need to use a search and replace because the links across over 200K records are similar but not

Re: [GENERAL] Regex help again (sorry, I am bad at these)

2015-12-28 Thread Félix GERZAGUET
Hello Chris, On Mon, Dec 28, 2015 at 8:10 PM, Christopher Molnar < cmol...@ourworldservices.com> wrote: > Any suggestions? > This seems to works: select regexp_replace('Complete the attached lab and submit via dropbox\rhttps://owncloud.porterchester.edu/HVACR/PCI_GasHeat/GasElectrical/HVACR1114_

Re: [GENERAL] Regex help again (sorry, I am bad at these)

2015-12-28 Thread Melvin Davidson
Will this work? UPDATE your_table SET your_column = REPLACE (your_column, 'HVACR1114_LAB_13A.pdf', '&file=HVACR1114_LAB_13A.pdf') WHERE ; Your mileage may vary because you have not stated your VERSION of PostgreSQL or your O/S. On Mon, Dec 28, 2015 at 2:10 PM, Christopher Molnar < cmol...@ou

Re: [GENERAL] grep -f keyword data query

2015-12-28 Thread Jeff Janes
On Sun, Dec 27, 2015 at 3:53 PM, Hiroyuki Sato wrote: > Hello Andreas and Tom > > Thank you for replying. > > Sorry, I re-created my questions. I was mis-pasted query log on previous > question. > (@~ operator is PGroonga extension (http://pgroonga.github.io)) > Please ignore it. > > Best regards.

Re: [GENERAL] Regex help again (sorry, I am bad at these)

2015-12-28 Thread David G. Johnston
On Mon, Dec 28, 2015 at 12:10 PM, Christopher Molnar < cmol...@ourworldservices.com> wrote: Given this... > 'Complete the attached lab and submit via dropbox\rhttps://owncloud.porterchester.edu/HVACR/PCI_GasHeat/GasElectrical/HVACR1114_LAB_13A.pdf"; > title="Lab 13A">Lab 13A<\a>' > ​I have no cl

Re: [GENERAL] Regex help again (sorry, I am bad at these)

2015-12-28 Thread David G. Johnston
On Mon, Dec 28, 2015 at 12:25 PM, Melvin Davidson wrote: > Will this work? > > UPDATE your_table >SET your_column = REPLACE (your_column, 'HVACR1114_LAB_13A.pdf', > '&file=HVACR1114_LAB_13A.pdf') > WHERE ; > > Your mileage may vary because you have not stated your VERSION of > PostgreSQL or

Re: [GENERAL] Regex help again (sorry, I am bad at these)

2015-12-28 Thread Melvin Davidson
Although, in this particular case, it is not version or O/S specific, it is generally a good policy (and manners) to state them whenever contacting this mail list. In that way, future users that refer back to problems have it documented as to which are and are not version specific. On Mon, Dec 28,

Re: [GENERAL] Regex help again (sorry, I am bad at these)

2015-12-28 Thread Christopher Molnar
Thank you Felix that was exactly what I needed! -Chris On Mon, Dec 28, 2015 at 2:23 PM, Félix GERZAGUET wrote: > Hello Chris, > > On Mon, Dec 28, 2015 at 8:10 PM, Christopher Molnar < > cmol...@ourworldservices.com> wrote: > >> Any suggestions? >> > This seems to works: > > select regexp_replac

Re: [GENERAL] Options for complex materialized views sharing most of the same logic?

2015-12-28 Thread rob stone
On Sun, 2015-12-27 at 15:39 -0600, Wells Oliver wrote: > I then have four different views which do largely the same thing, > totaling the days four different ways: > > 1) by last 10 > 2) by the last 30 > 3) by the last 60 > 4) by the entire year > > Each of these views is basically a copy of one

[GENERAL] plpgsql multidimensional array assignment results in array of text instead of subarrays

2015-12-28 Thread Michael Rasmussen
Hello, I’m running 9.4.5 locally on my mac doing some plpgsql development. I am trying to iterate through a multidimensional array using a foreach loop, as exampled in the documentation at http://www.postgresql.org/docs/9.4/static/plpgsql-control-structures.html#PLPGSQL-FOREACH-ARRAY. Here is a

Re: [GENERAL] plpgsql multidimensional array assignment results in array of text instead of subarrays

2015-12-28 Thread Tom Lane
Michael Rasmussen writes: > I am trying to iterate through a multidimensional array using a foreach loop, > as exampled in the documentation at > http://www.postgresql.org/docs/9.4/static/plpgsql-control-structures.html#PLPGSQL-FOREACH-ARRAY. > Here is a simplified version of the function: > C

Re: [GENERAL] plpgsql multidimensional array assignment results in array of text instead of subarrays

2015-12-28 Thread David G. Johnston
On Mon, Dec 28, 2015 at 4:05 PM, Michael Rasmussen wrote: > Hello, I’m running 9.4.5 locally on my mac doing some plpgsql development. > > I am trying to iterate through a multidimensional array using a foreach > loop, as exampled in the documentation at > http://www.postgresql.org/docs/9.4/stati

Re: [GENERAL] plpgsql multidimensional array assignment results in array of text instead of subarrays

2015-12-28 Thread David G. Johnston
On Mon, Dec 28, 2015 at 4:39 PM, Tom Lane wrote: > Michael Rasmussen writes: > > I am trying to iterate through a multidimensional array using a foreach > loop, as exampled in the documentation at > http://www.postgresql.org/docs/9.4/static/plpgsql-control-structures.html#PLPGSQL-FOREACH-ARRAY >

Re: [GENERAL] plpgsql multidimensional array assignment results in array of text instead of subarrays

2015-12-28 Thread Tom Lane
"David G. Johnston" writes: > ​or a more semantically meaning one...the use of the inner array is > arguably a hack here meant to avoid the overhead and new type creation by > assigning meaning to array slots. Yeah, good point: it looks like Mike does not consider the columns of the array to be

Re: [GENERAL] plpgsql multidimensional array assignment results in array of text instead of subarrays

2015-12-28 Thread Michael Rasmussen
Thank you all for your help. I currently only have the two cases to handle, so I went with the below if-else statement which works how I expected. -- Generate array of tables to create if (create_source) then the_tables := array[[new_table_schema, new_table_name],[new_table_schema||