[GENERAL] query not using index

2007-05-04 Thread Greg Janée
Hi, Postgres is refusing to use a GIST index on a spatial column. Here's the table and column and index: Table "public.scene" Column| Type | Modifiers -+-+--- ... footprint | ge

Re: [GENERAL] An alternatives to rules and triggers

2007-05-04 Thread brian
Glen Eustace wrote: Is there some way that one can determine whether a table has changed i.e. an insert, delete, update, without having to resort to setting a flag in another table using a triger or rule. I was wondering whether one of the system relations keep track of whether a table has be

Re: [GENERAL] An alternatives to rules and triggers

2007-05-04 Thread Tom Lane
Glen Eustace <[EMAIL PROTECTED]> writes: > I was wondering whether one of the system relations keep track of > whether a table has been modifed. Nope. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increa

[GENERAL] An alternatives to rules and triggers

2007-05-04 Thread Glen Eustace
Is there some way that one can determine whether a table has changed i.e. an insert, delete, update, without having to resort to setting a flag in another table using a triger or rule. I was wondering whether one of the system relations keep track of whether a table has been modifed. ---

Re: [GENERAL] Update violating constraint

2007-05-04 Thread Bruce Momjian
Alvaro Herrera wrote: > Alban Hertroys wrote: > > Richard Huxton wrote: > > > Alban Hertroys wrote: > > >> Naz Gassiep wrote: > > >>> Hi, > > >>> I'm trying to do an update on a table that has a unique constraint > > >>> on the field, I need to update the table by setting field = field+1 > > >

Re: [GENERAL] varchar as primary key

2007-05-04 Thread Jeff Davis
On Fri, 2007-05-04 at 23:45 +0200, Martijn van Oosterhout wrote: > On Fri, May 04, 2007 at 03:42:45PM -0400, Tom Lane wrote: > > It's hardly credible that you could do either strcmp or strcoll in 2 nsec > > on any run-of-the-mill hardware. What I think is happening is that the > > compiler is awar

Re: [GENERAL] Casting to varchar

2007-05-04 Thread Tom Lane
Michael Glaesemann <[EMAIL PROTECTED]> writes: > On May 4, 2007, at 15:34 , Scott Ribe wrote: >> Are there any other standard types that can't be cast >> to varchar? > You already got an answer to the first part of your question, but I > thought you might be interested in the second as well. No

Re: [GENERAL] varchar as primary key

2007-05-04 Thread Martijn van Oosterhout
On Fri, May 04, 2007 at 03:42:45PM -0400, Tom Lane wrote: > It's hardly credible that you could do either strcmp or strcoll in 2 nsec > on any run-of-the-mill hardware. What I think is happening is that the > compiler is aware that these are side-effect-free functions and is > removing the calls e

Re: [GENERAL] Casting to varchar

2007-05-04 Thread Michael Glaesemann
On May 4, 2007, at 15:34 , Scott Ribe wrote: Are there any other standard types that can't be cast to varchar? You already got an answer to the first part of your question, but I thought you might be interested in the second as well. Here's what I did: SELECT DISTINCT cast_from FROM pg_

Re: R: [GENERAL] Postgres 8.3-dev

2007-05-04 Thread Dave Page
Magnus Hagander wrote: Yeah. But look at the part about SYSTEM being the owner, I wonder if that's related. Hmm, that is odd. iirc, there is a Windows policy option that tells the installer to always run with elevated privileges. Do you know if that effectively runs installers as SYSTEM, or

Re: [GENERAL] Casting to varchar

2007-05-04 Thread Scott Ribe
> Sure, see CREATE CAST. Too simple ;-) I was expecting to have to dig into data type definitions... -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 722-0567 voice ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Casting to varchar

2007-05-04 Thread Alvaro Herrera
Raymond O'Donnell wrote: > On 04/05/2007 21:34, Scott Ribe wrote: > > >Just discovered (the hard way) that casting a boolean column ::varchar > >doesn't work. I assume I can add a function somewhere that will define a > >default cast for this? Are there any other standard types that can't be > >c

Re: [GENERAL] Casting to varchar

2007-05-04 Thread Alvaro Herrera
Scott Ribe wrote: > Just discovered (the hard way) that casting a boolean column ::varchar > doesn't work. I assume I can add a function somewhere that will define a > default cast for this? Sure, see CREATE CAST. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The

Re: [GENERAL] Casting to varchar

2007-05-04 Thread Raymond O'Donnell
On 04/05/2007 21:34, Scott Ribe wrote: Just discovered (the hard way) that casting a boolean column ::varchar doesn't work. I assume I can add a function somewhere that will define a default cast for this? Are there any other standard types that can't be cast I just use something like this: c

[GENERAL] Casting to varchar

2007-05-04 Thread Scott Ribe
Just discovered (the hard way) that casting a boolean column ::varchar doesn't work. I assume I can add a function somewhere that will define a default cast for this? Are there any other standard types that can't be cast to varchar? -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303

Re: [GENERAL] varchar as primary key

2007-05-04 Thread Tom Lane
Jeff Davis <[EMAIL PROTECTED]> writes: > $ ./cmp > locale set to: en_US.UTF-8 > strcmp time elapsed: 2034183 us > strcoll time elapsed: 2019880 us It's hardly credible that you could do either strcmp or strcoll in 2 nsec on any run-of-the-mill hardware. What I think is happening is that the comp

Re: [GENERAL] varchar as primary key

2007-05-04 Thread Jeff Davis
On Fri, 2007-05-04 at 13:52 -0400, Tom Lane wrote: > Jeff Davis <[EMAIL PROTECTED]> writes: > > I used strcmp() and strcoll() in a tight loop, and the result was > > indistinguishable. > > That's not particularly credible ... were you testing this in a > standalone test program? If so, did you re

Re: [GENERAL] varchar as primary key

2007-05-04 Thread Tom Lane
Jeff Davis <[EMAIL PROTECTED]> writes: > I used strcmp() and strcoll() in a tight loop, and the result was > indistinguishable. That's not particularly credible ... were you testing this in a standalone test program? If so, did you remember to do setlocale() first? Without that, you'll be in C l

Re: [GENERAL] varchar as primary key

2007-05-04 Thread Jeff Davis
On Thu, 2007-05-03 at 23:08 -0400, Tom Lane wrote: > Jeff Davis <[EMAIL PROTECTED]> writes: > > If you're using a non-C locale, it's slower than strcmp() too. > > PostgreSQL has to do an extra memcpy() in order to use strcoll(), > > because strings in postgresql aren't necessarily NULL-terminated a

Re: [GENERAL] varchar as primary key

2007-05-04 Thread Merlin Moncure
On 5/3/07, Alexander Staubo <[EMAIL PROTECTED]> wrote: PostgreSQL uses B-trees for its indexes, insertion time is logarithmic regardless of the type of the key, but strings have a larger overhead since they involve character comparisons; (i - j) is a lot faster than strcmp(i, j). If you do go for

Re: [GENERAL] cant get pg_dump/pg_restore to behave

2007-05-04 Thread Mike Frysinger
On 5/4/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Mike Frysinger" <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] 0 ~]$ psql -d gforge5 -f gforge.schema > ... > psql:gforge.schema:31: ERROR: could not access file > "$libdir/tsearch2": No such file or directory You don't have tsearch2 installed in

Re: [GENERAL] Query not using index despite high statistics

2007-05-04 Thread Tom Lane
Henrik Zagerholm <[EMAIL PROTECTED]> writes: > I have a SELECT query that uses Seq scans instead of index scan > despite that the index scan is faster. Try 8.2, it's a bit smarter about the costs of repeated indexscans on the inside of a nestloop. regards, tom lane ---

Re: [GENERAL] Permission denied to create database

2007-05-04 Thread Kevin Murphy
Richard Huxton wrote: Kevin Murphy wrote: Sleep deprived and surely doing something stupid here; I can't seem to confer the ability to create databases on a regular user. As a superuser: ALTER USER joe CREATEDB Thanks, Richard and others who replied. I don't have to deal with permissions very

Re: [GENERAL] script for taking incremental backup in postgres in LINUX

2007-05-04 Thread Ray Stell
On Thu, May 03, 2007 at 02:12:12AM -0700, pumesh wrote: > may lost. So what should i do to make the backup continuously or during > these intervals. http://www.postgresql.org/docs/8.2/interactive/continuous-archiving.html ---(end of broadcast)--- TI

Re: [GENERAL] Stored procedure

2007-05-04 Thread Hakan Kocaman
Hi, could you please post the complete code that you used to create the function. It sounds suspicously, that pg thinks 'testtable' is a coloum. Have you set proper quotes in your function-code? Maybe i got some mistakes regarding the usage of quote_literal in my sample code. Till later Haka

Re: [GENERAL] Permission denied to create database

2007-05-04 Thread Mikko Partio
> > $ sudo -u postgres psql -c "grant all on tablespace pg_default to joe" > Password: > GRANT > > $ createdb -U joe joejunkdb > createdb: database creation failed: ERROR: permission denied to create > database > How about ALTER ROLE joe CREATEDB Regards MP ---(end of

Re: [GENERAL] Stored procedure

2007-05-04 Thread Thorsten Kraus
Hi, thank you for your detailled answer! Today I had the possibility to test it in the office. The procedure could be stored. But when I call it SELECT create_geom_table('testtable') Then an error occurs: column testtable not available. Do you know why? Regards Hakan Kocaman schrieb: Hi,

Re: [GENERAL] multi-language web application: is it possible?

2007-05-04 Thread Tino Wildenhain
Elim Qiu schrieb: > I have many tables like the table Person:below, in mysql database. > > person_id, first_name,last_name, mi, gb_first_name, gb_last_name, > b5_first_name, b5_last_name, gender, dob > > where different columns storing strings in different encodings. At > anytime, a web user

Re: R: [GENERAL] Postgres 8.3-dev

2007-05-04 Thread Tom Lane
Dave Page <[EMAIL PROTECTED]> writes: > The error in the log is in the create conversions phase of initdb, so I > doubt it's an installer issue. I don't have time to look right now, but > does initdb do anything unusual there? I've got a sneaking suspicion > I've seen a failure at this point bef

[GENERAL] multi-language web application: is it possible?

2007-05-04 Thread Elim Qiu
I have many tables like the table Person:below, in mysql database. person_id, first_name,last_name, mi, gb_first_name, gb_last_name, b5_first_name, b5_last_name, gender, dob where different columns storing strings in different encodings. At anytime, a web user can switch the language and the ap

Re: [GENERAL] cant get pg_dump/pg_restore to behave

2007-05-04 Thread Tom Lane
"Mike Frysinger" <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] 0 ~]$ psql -d gforge5 -f gforge.schema > ... > psql:gforge.schema:31: ERROR: could not access file > "$libdir/tsearch2": No such file or directory You don't have tsearch2 installed in the new installation. r

Re: [GENERAL] Permission denied to create database

2007-05-04 Thread Ashish Karalkar
Can u tell us what are the role privilages granted to user "joe" May be you r missing with the create database privilage to user joe With Regards Ashish - Original Message - From: "Kevin Murphy" <[EMAIL PROTECTED]> To: Sent: Friday, May 04, 2007 6:36 PM Subject: [GENERAL] Permiss

Re: [GENERAL] Permission denied to create database

2007-05-04 Thread Richard Huxton
Kevin Murphy wrote: Sleep deprived and surely doing something stupid here; I can't seem to confer the ability to create databases on a regular user. I always get "permission denied to create database". One note: template1 has had some C functions added to it. Could that be related to the pro

[GENERAL] Permission denied to create database

2007-05-04 Thread Kevin Murphy
Sleep deprived and surely doing something stupid here; I can't seem to confer the ability to create databases on a regular user. I always get "permission denied to create database". One note: template1 has had some C functions added to it. Could that be related to the problem? $ createdb -U

Re: [GENERAL] Have I b0rked something? Slow comparisons on "where x in (...)"

2007-05-04 Thread Listmail
I used VALUES as a replacement for the temporary table since for this application, it is a lot more useful. The point is : SELECT * FROM table WHERE value IN ( 1000 integers ) : does 1000 comparisons for each row SELECT * FROM table WHERE value IN ( VALUES (1000 integerss) ) : bu

R: R: [GENERAL] Postgres 8.3-dev

2007-05-04 Thread Paolo Saudin
> There is no 8.2.4.1 version. There is 8.2.4 or 8.2.1. or are you using > EnterpriseDB and not PostgreSQL? IIRC, the installer is differnt there... Sorry, the version is 8.2.4, the latest available on the PostgreSQL web site and I am using only PostgreSQL. > Is this both for the service account

Re: [GENERAL] cant get pg_dump/pg_restore to behave

2007-05-04 Thread Mike Frysinger
On 5/4/07, Tom Lane <[EMAIL PROTECTED]> wrote: Well, I loaded and dumped and reloaded this schema in 8.1 without any problem, so I'm still baffled. oh, and the machine that i created the dump on and the machine i loaded the dump on are both Fedora Core 6 that report: $ postgres --version postgr

Re: [GENERAL] cant get pg_dump/pg_restore to behave

2007-05-04 Thread Mike Frysinger
On 5/4/07, Tom Lane <[EMAIL PROTECTED]> wrote: There are several obvious things wrong with that (eg, psql cannot read -Fc format dumps) so I suppose it's an editorialization on what you really typed. right, what i posted was a typo, what i ran did not have the -Fc Perhaps the problem is hidde

Re: [GENERAL] Have I b0rked something? Slow comparisons on "where x in (...)"

2007-05-04 Thread Alban Hertroys
Listmail wrote: > > Followup to my previous test, with an index this time > > EXPLAIN ANALYZE SELECT * FROM test WHERE value IN ( 1000 integers ) I'm not quite sure what you're trying to measure here, but I don't think it is what was suggested. IIRC the suggestion was to move the values fro

Re: R: [GENERAL] Postgres 8.3-dev

2007-05-04 Thread Magnus Hagander
On Fri, May 04, 2007 at 09:38:48AM +0100, Dave Page wrote: > Magnus Hagander wrote: > >On Fri, May 04, 2007 at 09:00:32AM +0200, Paolo Saudin wrote: > >>I am trying to install the 8.3-dev version on a Vmware virtual machine > >>with > >>WinXP SP2. I am able to install the 8.2.4.1 version with no p

Re: R: [GENERAL] Postgres 8.3-dev

2007-05-04 Thread Dave Page
Magnus Hagander wrote: On Fri, May 04, 2007 at 09:00:32AM +0200, Paolo Saudin wrote: I am trying to install the 8.3-dev version on a Vmware virtual machine with WinXP SP2. I am able to install the 8.2.4.1 version with no problem using the very same settings for both servers as follow: There is

[GENERAL] Query not using index despite high statistics

2007-05-04 Thread Henrik Zagerholm
Hello list, I have a SELECT query that uses Seq scans instead of index scan despite that the index scan is faster. Below is the query and its first run with enable seqsan = true which give a Seq Scan on tbl_structure (cost=0.00..19147.29 rows=172229 width=97) (actual time=0.094..878.309

Re: R: [GENERAL] Postgres 8.3-dev

2007-05-04 Thread Magnus Hagander
On Fri, May 04, 2007 at 09:00:32AM +0200, Paolo Saudin wrote: > I am trying to install the 8.3-dev version on a Vmware virtual machine with > WinXP SP2. I am able to install the 8.2.4.1 version with no problem using > the very same settings for both servers as follow: There is no 8.2.4.1 version.

R: [GENERAL] Postgres 8.3-dev

2007-05-04 Thread Paolo Saudin
I am trying to install the 8.3-dev version on a Vmware virtual machine with WinXP SP2. I am able to install the 8.2.4.1 version with no problem using the very same settings for both servers as follow: SETTINGS : Account name postgres with password postmaster Accept connections on all addresses, no