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 h.g.k.vanlin...@uu.nl 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

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 h.g.k.vanlin...@uu.nl wrote: On Thu, Sep 09, 2010 at

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

[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 jgo...@gmail.com On Fri, Sep 10, 2010 at 10:03, Ketema Harris ket...@gmail.com wrote: Hello, I have a table defined as: CREATE TABLE

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     jgo...@gmail.com On Fri, Sep 10, 2010 at 10:03, Ketema Harris ket...@gmail.com

Re: [GENERAL] User function canceling VACUUMDB utility

2010-09-10 Thread Tom Lane
Carlos Henrique Reimer carlos.rei...@opendb.com.br 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

[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

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread Richard Broersma
On Fri, Sep 10, 2010 at 8:12 AM, Carlos Mennens carlos.menn...@gmail.com 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

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 carlos.menn...@gmail.com 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

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-10 Thread Carlos Mennens
On Fri, Sep 10, 2010 at 11:33 AM, Richard Broersma richard.broer...@gmail.com 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

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 richard.broer...@gmail.com 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

[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 dave.gauth...@intel.com 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 dave.gauth...@intel.com 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'

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 !

[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.

Re: [GENERAL] regexp on null

2010-09-10 Thread Richard Broersma
On Fri, Sep 10, 2010 at 9:56 AM, Gauthier, Dave dave.gauth...@intel.com 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

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. age...@themactionfaction.com 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

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

Re: [GENERAL] Frustration with \copy

2010-09-10 Thread Tom Lane
Ralph Smith rsm...@10kinfo.com 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

Re: [GENERAL] sql DO in rule 9.0rc1

2010-09-10 Thread Tom Lane
Joshua D. Drake j...@commandprompt.com 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

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 dave.gauth...@intel.com 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

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 - 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 richard.broer...@gmail.com 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. :)

Re: [GENERAL] regexp on null

2010-09-10 Thread Dmitriy Igrishin
Agree with David. Regards, Dmitriy 2010/9/10 David Fetter da...@fetter.org On Fri, Sep 10, 2010 at 10:25:55AM -0700, Richard Broersma wrote: On Fri, Sep 10, 2010 at 9:56 AM, Gauthier, Dave dave.gauth...@intel.com wrote: Ya, I kinda knew about these approaches. The problem ahs to do

[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

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 nboutel...@gmail.com 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

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

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 nboutel...@gmail.com wrote: What would be the regexp_split_to_table pattern that

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

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

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

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.