Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Alexander Farber
Hello, really good advices here! But - On Sun, Oct 17, 2010 at 2:37 AM, Rob Sargent robjsarg...@gmail.com wrote: I just read the anonymously part, so I take it you have ruled out recording the given coordinate components directly, in multiple columns presumably?  Otherwise it seems you could

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Harald Fuchs
In article 4cba2bc4.9030...@darrenduncan.net, Darren Duncan dar...@darrenduncan.net writes: I would further recommend turning the above into a separate data type, especially if you'd otherwise be using that constraint in several places, like this ... FWIW, the shatypes contrib package

Re: [GENERAL] input out of error with haversine formula

2010-10-17 Thread Dean Rasheed
On 16 October 2010 21:13, Vince Carney vincecar...@gmail.com wrote: Is it possible to do an if/else statement inside acos() to account for a 1 or -1. I can't seem to get if/else working in postgres? Try to stay on-list, so that others can benefit from the discussion. Yes you could use

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Alexander Farber
Hello again, I have 1 more question please: how do you select the x and y parts of a point data type? Can't find it in http://www.postgresql.org/docs/8.4/interactive/functions-geometry.html For example, I have this table with a pos column: snake= \d gps Table public.gps

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Tom Lane
Alexander Farber alexander.far...@gmail.com writes: how do you select the x and y parts of a point data type? pointval[0] and pointval[1] --- this is mentioned somewhere in the fine print in the geometric functions and operators page, IIRC. regards, tom lane -- Sent

[GENERAL] Need some help setting up pgAgent

2010-10-17 Thread Mike Christensen
Okay my required n00b question of the week, hopefully this'll be an easy one.. I decided to give pgAgent a shot, because there's this stored sproc (sorry, function) I need to run nightly and I think spending hours figuring out pgAgent would somehow be better than the 3 minutes it would take to

Re: [GENERAL] installing from source in Windows

2010-10-17 Thread Turner, John J
Yup - after hunting around a bit I realized MSYS was missing, so I installed it. Good news: I now have a Bash interface and ./configure ran successfully Bad news: Now the install process bombs out when I attempt to make (it gets Error 1 and Error 2 and backs out of the /c/program

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Rob Sargent
Alexander Farber wrote: Hello, really good advices here! But - On Sun, Oct 17, 2010 at 2:37 AM, Rob Sargent robjsarg...@gmail.com wrote: I just read the anonymously part, so I take it you have ruled out recording the given coordinate components directly, in multiple columns presumably?

Re: [GENERAL] Automated Database Backups

2010-10-17 Thread John Iliffe
Thanks to those who replied to my post. I tried that and works a treat! Regards. John == On Sat, 2010-16-10 at 17:18 +0100, Raymond O'Donnell wrote: On 15/10/2010 22:12, John Iliffe wrote: Does anyone have a way to run pg_dump from cron

Re: [GENERAL] Internationalisation of database content (text columns)

2010-10-17 Thread Karsten Hilbert
On Fri, Oct 08, 2010 at 12:12:54PM +0200, Wolfgang Keller wrote: I'm working on a database schema which contains lots of type code lookup tables. The entries of these tables are also hierarchically related among themselves (subtype/supertype), to store rather large and quite complex

Re: [GENERAL] installing from source in Windows

2010-10-17 Thread Daniel Verite
Turner, John J wrote: Bad news: Now the install process bombs out when I attempt to make (it gets Error 1 and Error 2 and backs out of the /c/program files/postgresql-9.0.0/src directory) FWIW, it works for me. Error X being too little to guess anything, maybe you should paste here

Re: [GENERAL] installing from source in Windows

2010-10-17 Thread Turner, John J
Bad news: Now the install process bombs out when I attempt to make (it gets Error 1 and Error 2 and backs out of the /c/program files/postgresql-9.0.0/src directory) This is the full log of what happens when I run make: $ make make -C src all make[1]: Entering directory

[GENERAL] Selecting top N percent of records.

2010-10-17 Thread Tim Uckun
Is there a way to select the top 10% of the values from a column? For example the top 10% best selling items where number of sales is a column. Thanks. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Selecting top N percent of records.

2010-10-17 Thread Darren Duncan
Tim Uckun wrote: Is there a way to select the top 10% of the values from a column? For example the top 10% best selling items where number of sales is a column. The top 10% would be a variable number of records. Is that what you want, or would you rather, say, just see the top N items?

Re: [GENERAL] Fastest way to check database's existence

2010-10-17 Thread Kynn Jones
Thank you all for your comments and suggestions! ~kj

Re: [GENERAL] Selecting top N percent of records.

2010-10-17 Thread Peter Geoghegan
On 18 October 2010 00:33, Tim Uckun timuc...@gmail.com wrote: Is there a way to select the top 10% of the values from a column? For example the top 10% best selling items where number of sales is a column. That is a bit problematic because it necessitates knowing the number of rows total, and

Re: [GENERAL] Selecting top N percent of records.

2010-10-17 Thread Tim Uckun
On Mon, Oct 18, 2010 at 12:53 PM, Darren Duncan dar...@darrenduncan.net wrote: Tim Uckun wrote: Is there a way to select the top 10% of the values from a column? For example the top 10% best selling items where number of sales is a column. The top 10% would be a variable number of records.

Re: [GENERAL] Selecting top N percent of records.

2010-10-17 Thread Tim Uckun
That is a bit problematic because it necessitates knowing the number of rows total, and slow counting is an idiosyncrasy of postgres. http://wiki.postgresql.org/wiki/Slow_Counting To get the top 10%: SELECT * FROM table LIMIT(SELECT (COUNT(*) * 0.1)::integer FROM table) I think I wasn't

Re: [GENERAL] installing from source in Windows

2010-10-17 Thread Craig Ringer
On 10/18/2010 06:18 AM, Turner, John J wrote: ../../src/include/c.h:284:2: #error must have a working 64-bit integer datatype There's your problem. configure didn't detect support for 64-bit integers in your compiler, causing the build to fail at: 00276 #ifndef HAVE_INT64

Re: [GENERAL] Selecting top N percent of records.

2010-10-17 Thread Craig Ringer
On 10/18/2010 08:06 AM, Tim Uckun wrote: That is a bit problematic because it necessitates knowing the number of rows total, and slow counting is an idiosyncrasy of postgres. http://wiki.postgresql.org/wiki/Slow_Counting To get the top 10%: SELECT * FROM table LIMIT(SELECT (COUNT(*) *

Re: [GENERAL] Selecting top N percent of records.

2010-10-17 Thread Tim Uckun
OK, so you want a median-style sort them in descending order and count down until you've selected the first 10% of rows approach? In other words, values in the 90th percentile of the distribution? Try this. Given table x with single integer column y, obtain rows of x in the 90th percentile

Re: [GENERAL] installing from source in Windows

2010-10-17 Thread Greg Smith
Turner, John J wrote: I'm reluctant at this point to wipe out my MinGW and MSYS and start from scratch with Windows SDK and/or VS-ee... Well, you should probably get over that, because all of the official builds of 9.0 don't really care about supporting MinGW anymore. See

Re: [GENERAL] Selecting top N percent of records.

2010-10-17 Thread Brent Wood
Something like this should work - (but is untested), and does require the extra subquery, so there may be a more efficient way? However, off the top of my head: select a,b,c from table where order by c desc limit (select count(*)/10 from table where ); where c is the no of sales column

[GENERAL] How to track error messages come from plpy.execute?

2010-10-17 Thread guti deng
Hi there, The problem is, i call a stored function with 'plpy.execute()', and there may be error thrown out from the callee function. I want to get the error message. I try to put plpy.execute into a python try-except, but i doesn't work. Anyone has an idea? Explanation about the context:

Re: [GENERAL] installing from source in Windows

2010-10-17 Thread Craig Ringer
On 10/18/2010 11:28 AM, Turner, John J wrote: .. I thought it was worth a shot to try building from source with MinGW/MSYS to get the pgxs files... but apparently not -- especially since I'm on Windows XP 32-bit platform (hence the issue with 64-bit datatypes bombing out during make, I presume)

Re: [GENERAL] installing from source in Windows

2010-10-17 Thread Turner, John J
Hmmm.. seems like I'm in a dandy of a catch-22 On an earlier post (http://archives.postgresql.org/pgsql-general/2010-09/msg01043.php) I was inquiring about trying to add in Jeff Davis' temporal extension package available from pgFoundry. Based on the facts that: 1) the temporal package

Re: [GENERAL] installing from source in Windows

2010-10-17 Thread Tom Lane
Greg Smith g...@2ndquadrant.com writes: Well, you should probably get over that, because all of the official builds of 9.0 don't really care about supporting MinGW anymore. See http://www.postgresql.org/docs/9.0/interactive/install-windows.html for notes on this. I wouldn't be surprised

[GENERAL] How to find which query are doing seq_scan

2010-10-17 Thread AI Rumman
I am using Postgresql 8.1. I need to know which query are executing seq_scan on tables as statistics said there were 4 seq_scan on the tables for the last 2 days. Any idea please.

Re: [GENERAL] installing from source in Windows

2010-10-17 Thread Craig Ringer
On 10/18/2010 12:29 PM, Turner, John J wrote: Craig, thanks for having a go at it - and thanks for all the help thus far! OK. According to your config.log, configure tests long int and determines it's only 32 bits, so tries long long int and determines that it's 64 bits wide. So there is a