Re: [GENERAL] Forcing the right queryplan

2010-09-10 Thread Henk van Lingen
On Thu, Sep 09, 2010 at 11:16:36AM -0400, Tom Lane wrote: > Henk van Lingen writes: > > On Thu, Sep 09, 2010 at 10:50:52AM -0400, Tom Lane wrote: > Well, there's your problem: the planner is off by a factor of about 500 > on its estimate of the number of rows matching this query,

Re: [GENERAL] Forcing the right queryplan

2010-09-10 Thread Arjen Nienhuis
Maybe you can extract stuff like IP addresses and words like 'error' and put it in a separate column in the table. Full text search is not a solution for data that is in a wrong format. On Fri, Sep 10, 2010 at 10:27 AM, Henk van Lingen wrote: > On Thu, Sep 09, 2010 at 11:16:36AM -0400, Tom Lane w

Re: [GENERAL] User function canceling VACUUMDB utility

2010-09-10 Thread Carlos Henrique Reimer
Hi, Yes, you're right! I found out a functional index using this function and ANALYZE also cancels. Is there a way to code this function in a way VACUUM/ANALYZE does not cancel? Thank you! brasil=# analyze "BRASIL".tt_tit; ERROR: invalid type name "TT_TIT.SEQCAN%TYPE" CONTEXT: compile of PL/p

[GENERAL] Good candidate query for window syntax?

2010-09-10 Thread Ketema Harris
Hello, I have a table defined as: CREATE TABLE demo AS ( id serial PRIMARY KEY, start_time timestamp without timezone, duration integer ) A sample data set I am working with is: start_time | duration | end_time -+--+---

Re: [GENERAL] Good candidate query for window syntax?

2010-09-10 Thread Jorge Godoy
Have you checked the OVERLAPS operator in the documentation? http://www.postgresql.org/docs/8.4/interactive/functions-datetime.html -- Jorge Godoy On Fri, Sep 10, 2010 at 10:03, Ketema Harris wrote: > Hello, I have a table defined as: > > CREATE TABLE demo AS > ( >id serial PR

Re: [GENERAL] Good candidate query for window syntax?

2010-09-10 Thread Ketema
On Sep 10, 9:08 am, jgo...@gmail.com (Jorge Godoy) wrote: > Have you checked the OVERLAPS operator in the documentation? > > http://www.postgresql.org/docs/8.4/interactive/functions-datetime.html > > -- > Jorge Godoy     > > > > On Fri, Sep 10, 2010 at 10:03, Ketema Harris wrote: > > Hello,  I ha

Re: [GENERAL] User function canceling VACUUMDB utility

2010-09-10 Thread Tom Lane
Carlos Henrique Reimer writes: > Yes, you're right! I found out a functional index using this function and > ANALYZE also cancels. > Is there a way to code this function in a way VACUUM/ANALYZE does not > cancel? I think your problem is probably a search_path issue, ie vacuumdb is not running wi

[GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread Carlos Mennens
I am brand new to PostgreSQL and coming from MySQL. My question is does anyone know after I install PostgreSQL on my Linux server, is there a script that secures the database like MySQL offers in most Linux distributions? I think the script for MySQL is "/usr/bin/mysql_secure_installation". I check

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread Richard Broersma
On Fri, Sep 10, 2010 at 8:12 AM, Carlos Mennens wrote: > Do you guys know if this exist for PostgreSQL and or do you have any > suggestions for a fresh installation of PostgreSQL on Linux? I don't believe there is a script like this. However, I would say that out of the box, PostgreSQL is so se

Re: [GENERAL] Good candidate query for window syntax?

2010-09-10 Thread Ketema Harris
Ok I have been flailing at trying to understand both syntax and concepts...I think I am moving forward as I have a query that returns a result...its just the wrong result SELECT count(*) OVER w as max_concurrency, start_time::date as "interval" FROM demo GROUP BY start_time::date,

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread Tom Lane
Carlos Mennens writes: > I am brand new to PostgreSQL and coming from MySQL. My question is > does anyone know after I install PostgreSQL on my Linux server, is > there a script that secures the database like MySQL offers in most > Linux distributions? I think the script for MySQL is > "/usr/bin/m

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread Carlos Mennens
On Fri, Sep 10, 2010 at 11:33 AM, Richard Broersma wrote: > I don't believe there is a script like this.  However, I would say > that out of the box, PostgreSQL is so secure that some people cannot > figure out how to log in. :) I agree and I am just now learning this. I can't seem to find out ho

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread David Fetter
On Fri, Sep 10, 2010 at 11:53:12AM -0400, Carlos Mennens wrote: > On Fri, Sep 10, 2010 at 11:33 AM, Richard Broersma > wrote: > > I don't believe there is a script like this.  However, I would say > > that out of the box, PostgreSQL is so secure that some people > > cannot figure out how to log in

[GENERAL] regexp on null

2010-09-10 Thread Gauthier, Dave
8.3.4 on Linux Is there a way to regexp match on a null value? Or is it necessary to OR in a "or x is null"? Thanks in Advance !

Re: [GENERAL] regexp on null

2010-09-10 Thread Dmitriy Igrishin
Hey Dave, Did you consider to use coalesce() ? Regards, Dmitriy 2010/9/10 Gauthier, Dave > 8.3.4 on Linux > > > > Is there a way to regexp match on a null value? Or is it necessary to OR > in a "or x is null"? > > > > Thanks in Advance ! >

Re: [GENERAL] regexp on null

2010-09-10 Thread Richard Broersma
On Fri, Sep 10, 2010 at 9:00 AM, Gauthier, Dave wrote: > Is there a way to regexp match on a null value? I would say no. >  Or is it necessary to OR in a "or x is null"? you could use a COALESCE( text_column, '') ~ E'MyRegEx'; Or perhaps: ( text_column ~ E'MyRegEx' ) IS UNKNOWN might

Re: [GENERAL] regexp on null

2010-09-10 Thread Gauthier, Dave
Ya, I kinda knew about these approaches. The problem ahs to do with novice users who don't know about coalesce or or;ing a check ofr nulls. I was hoping there was some special regexp expression that would match to a null. Thanks for the quick response, and have a great weekend ! -Original

[GENERAL] Frustration with \copy

2010-09-10 Thread Ralph Smith
As someone famous once said: The documentation I've found on \copy says to see the docs on copy ;) It's *supposed* to match the backend syntax, but seems a few bricks shy of a load at the moment. Anyone feel like fixing it? See parse_slash_copy() in src/bin/psql/copy.c. Th

Re: [GENERAL] regexp on null

2010-09-10 Thread Richard Broersma
On Fri, Sep 10, 2010 at 9:56 AM, Gauthier, Dave wrote: > Ya, I kinda knew about these approaches.  The problem ahs to do with novice > users who don't know about coalesce or or;ing a check ofr nulls.  I was > hoping there was some special regexp expression that would match to a null. Perhaps t

Re: [GENERAL] sql DO in rule 9.0rc1

2010-09-10 Thread A.M.
On Sep 9, 2010, at 8:31 PM, Jeff Davis wrote: > On Thu, 2010-09-09 at 17:07 -0400, A.M. wrote: >> Is there a technical limitation which prevents DO from being used in rules >> or am I missing something with this? >> >> CREATE RULE test_update AS ON UPDATE TO test DO INSTEAD DO $$

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread Arjen Nienhuis
>    su - postgres >    psql -l If you didn't set a password for the postgres user it's actually: sudo su - postgres -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] sql DO in rule 9.0rc1

2010-09-10 Thread Merlin Moncure
On Fri, Sep 10, 2010 at 1:30 PM, A.M. wrote: > On Sep 9, 2010, at 8:31 PM, Jeff Davis wrote: >> On Thu, 2010-09-09 at 17:07 -0400, A.M. wrote: >>> Is there a technical limitation which prevents DO from being used in rules >>> or am I missing something with this? >>> >>> CREATE RULE test_update AS

Re: [GENERAL] sql DO in rule 9.0rc1

2010-09-10 Thread Joshua D. Drake
On Fri, 2010-09-10 at 13:39 -0400, Merlin Moncure wrote: > IDK...functions do everything 'DO' does, and support returning data, > which is necessary to support RETURNING. Rules are already fairly > capricious and problematic and I doubt any proposal that doesn't fix > or work around their basic f

Re: [GENERAL] Frustration with \copy

2010-09-10 Thread Tom Lane
Ralph Smith writes: > I have a one column .txt file on Ubuntu that I'm trying to upload, and > \copy new_coupons '/home/rsmith/testfile.txt' I think you need \copy new_coupons from '...' Like it says, it's supposed to match the backend syntax, modulo needing a starting backsl

Re: [GENERAL] sql DO in rule 9.0rc1

2010-09-10 Thread Tom Lane
"Joshua D. Drake" writes: > On Fri, 2010-09-10 at 13:39 -0400, Merlin Moncure wrote: >> IDK...functions do everything 'DO' does, and support returning data, >> which is necessary to support RETURNING. Rules are already fairly >> capricious and problematic and I doubt any proposal that doesn't fix

Re: [GENERAL] Frustration with \copy

2010-09-10 Thread David Fetter
On Fri, Sep 10, 2010 at 10:25:52AM -0700, Ralph Smith wrote: > Yes, we are planning to upgrade to 8.3, but now I'm stuck w/ 7.4. Don't stay stuck there too long. It's about to end its life, as are 8.0 and 8.1, later this year. http://wiki.postgresql.org/wiki/PostgreSQL_Release_Support_Policy >

Re: [GENERAL] regexp on null

2010-09-10 Thread David Fetter
On Fri, Sep 10, 2010 at 10:25:55AM -0700, Richard Broersma wrote: > On Fri, Sep 10, 2010 at 9:56 AM, Gauthier, Dave > wrote: > > Ya, I kinda knew about these approaches.  The problem ahs to do > > with novice users who don't know about coalesce or or;ing a check > > ofr nulls.  I was hoping there

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread björn lundin
>I can't seem to find out how > to login to the database. I am using 'psql -U root' however during my > installation there may have been a default password used which I am > not aware of. I need to read the docs and see how to login to the > database. I usually do like this on a new box sudo su -

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread Thomas Kellerer
Carlos Mennens wrote on 10.09.2010 17:53: On Fri, Sep 10, 2010 at 11:33 AM, Richard Broersma wrote: I don't believe there is a script like this. However, I would say that out of the box, PostgreSQL is so secure that some people cannot figure out how to log in. :) I agree and I am just now l

Re: [GENERAL] regexp on null

2010-09-10 Thread Dmitriy Igrishin
Agree with David. Regards, Dmitriy 2010/9/10 David Fetter > On Fri, Sep 10, 2010 at 10:25:55AM -0700, Richard Broersma wrote: > > On Fri, Sep 10, 2010 at 9:56 AM, Gauthier, Dave > wrote: > > > Ya, I kinda knew about these approaches. The problem ahs to do > > > with novice users who don't kno

[GENERAL] Regular expression that splits CSV string into table

2010-09-10 Thread Nick
What would be the regexp_split_to_table pattern that splits a comma separated string into a table? Im having trouble when a string contains commas or there are commas at the beginning or end String ',one,two,''three,four'',five,six,' Should return ,one two three,four five six, -- Sent via pgsql

Re: [GENERAL] Regular expression that splits CSV string into table

2010-09-10 Thread bricklen
On Fri, Sep 10, 2010 at 3:43 PM, Nick wrote: > What would be the regexp_split_to_table pattern that splits a comma > separated string into a table? Im having trouble when a string > contains commas or there are commas at the beginning or end > > String > ',one,two,''three,four'',five,six,' > > Sho

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread Craig Ringer
On 09/11/2010 01:39 AM, Arjen Nienhuis wrote: su - postgres psql -l If you didn't set a password for the postgres user it's actually: sudo su - postgres Better written, and less prone to being broken by odd shell setups, as: sudo -u postgres psql -- Craig Ringer -- Sent via pgsq

Re: [GENERAL] Regular expression that splits CSV string into table

2010-09-10 Thread Nick
Yes, that gets down to the root of my question... what is the expression that would properly split the values? -Nick On Sep 10, 4:43 pm, brick...@gmail.com (bricklen) wrote: > On Fri, Sep 10, 2010 at 3:43 PM, Nick wrote: > > What would be the regexp_split_to_table pattern that splits a comma > >

Re: [GENERAL] Regular expression that splits CSV string into table

2010-09-10 Thread Alvaro Herrera
Excerpts from Nick's message of vie sep 10 20:36:24 -0400 2010: > Yes, that gets down to the root of my question... what is the > expression that would properly split the values? -Nick The only idea that comes to mind right now is to remove them before processing the rest of the string, and put th

Re: [GENERAL] Regular expression that splits CSV string into table

2010-09-10 Thread Nick
I dont mind if the commas are at the beginning and end, im more concerned about "three,four" staying in one row because its surrounded by quotes. -Nick On Sep 10, 6:03 pm, alvhe...@commandprompt.com (Alvaro Herrera) wrote: > Excerpts from Nick's message of vie sep 10 20:36:24 -0400 2010: > > > Yes

[GENERAL] SQL Programming Question

2010-09-10 Thread tony
Coming from 25 years of programming applications based on dBASE and FoxPro tables, I have a question about how to deal with a programming task. I have a situation where I receive a file with transactions that have a unique key from a vendor. These transactions should only be imported into my syste

Re: [GENERAL] SQL Programming Question

2010-09-10 Thread Scott Bailey
On 09/10/2010 08:07 PM, t...@exquisiteimages.com wrote: I have a situation where I receive a file with transactions that have a unique key from a vendor. These transactions should only be imported into my system once, but the vendor system will occasionally resend a transaction by mistake. The w

Re: [GENERAL] SQL Programming Question

2010-09-10 Thread John R Pierce
On 09/10/10 8:07 PM, t...@exquisiteimages.com wrote: Coming from 25 years of programming applications based on dBASE and FoxPro tables, I have a question about how to deal with a programming task. I have a situation where I receive a file with transactions that have a unique key from a vendor.