[GENERAL] Trigger function which inserts into table; values from lookup

2007-05-19 Thread novnov
Not sure it the title of this post gives a clear message...I need to have a trigger function insert records into a table under certain conditions, where the values inserted are partially based on the results of a select query. table t_item item_id (pk) item_name item_org_id item_active table

Re: [GENERAL] tsearch2 keep throw-away characters

2007-05-19 Thread Ivan Zolotukhin
Hello, Your problem is not about stop words, it's about the fact that tsearch parser treats '+' and '#' symbols as a lexemes of a blank type (use ts_debug() function to figure it out) and drops it without any further processing. AFAIK, typical solution for this is to rewrite your text and then qu

Re: [GENERAL] FULL JOIN is only supported with merge-joinable join conditions

2007-05-19 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > I try to port application to PostgreSQL 8.1+ > The following query runs OK in VFP but causes error in Postgres > FULL JOIN is only supported with merge-joinable join conditions > SELECT > ... > FROM iandmed > FULL JOIN koosseis ON iandmed.ametikoht=koosseis

Re: [GENERAL] Performance tuning?

2007-05-19 Thread Robert Fitzpatrick
On Sat, 2007-05-19 at 19:19 -0400, Tom Lane wrote: > You're comparing fields of distinct types, which not only incurs > run-time type conversions but can interfere with the ability to > use some plan types at all. Looking at the table definitions, > you've got primary keys declared as SERIAL (ie,

Re: [GENERAL] Performance tuning?

2007-05-19 Thread Tom Lane
I wrote: > Another thing that might be worth fixing is the rather silly use of '%%%' > rather than '%' for a no-op LIKE pattern. It looks like the planner's > LIKE-estimator gets fooled by that and doesn't realize it's a > match-everything pattern. Uh, scratch that advice, I fat-fingered my test.

Re: [GENERAL] Performance tuning?

2007-05-19 Thread Tom Lane
Robert Fitzpatrick <[EMAIL PROTECTED]> writes: > On Sat, 2007-05-19 at 17:05 -0400, Tom Lane wrote: >> Show us the table definitions and the EXPLAIN ANALYZE output, please. There seem to be a couple of problems visible in the EXPLAIN output: > -> Nested Loop (cost=53060.03..53565.7

Re: [GENERAL] Performance tuning?

2007-05-19 Thread Robert Fitzpatrick
On Sat, 2007-05-19 at 17:05 -0400, Tom Lane wrote: > Robert Fitzpatrick <[EMAIL PROTECTED]> writes: > > I am running the following query on a linux server with comparable > > processor and memory as the windows server. > > Show us the table definitions and the EXPLAIN ANALYZE output, please. > T

Re: [GENERAL] change database encoding without corrupting data (latin9 to utf8)

2007-05-19 Thread Michael Fuhr
On Fri, May 18, 2007 at 02:46:26AM -0700, filippo wrote: > I have a problem to entry data to postgres database (latin9) from my > perl/tk application running on windows (utf8). Whenever I try to entry > letter with accents, these looks corrupted once stored into database. > > A workaround is to se

Re: [GENERAL] Performance tuning?

2007-05-19 Thread Tom Lane
Robert Fitzpatrick <[EMAIL PROTECTED]> writes: > I am running the following query on a linux server with comparable > processor and memory as the windows server. Show us the table definitions and the EXPLAIN ANALYZE output, please. regards, tom lane --

[GENERAL] Performance tuning?

2007-05-19 Thread Robert Fitzpatrick
We have a MS SQL server db that we successfully migrated to pgsql 8.2 and I am now working on some views and notice select queries being very slow. I have vacuumed last night and running the exact same query (with minor changes to syntax of course), it runs in just a few seconds compared to several

[GENERAL] Against legal disclaimers in email

2007-05-19 Thread Tom Lane
[ redirected for a wider audience ] Lew <[EMAIL PROTECTED]> writes: > John Summerfield wrote: >> Penchalaiah P. wrote: >>> Information transmitted by this e-mail is proprietary to Infinite >>> Computer Solutions >> >> It may be proprietary, but it shore ain't confidential! > Placing "confident

Re: [GENERAL] Data replication through disk replication

2007-05-19 Thread Joshua D. Drake
Alvaro Herrera wrote: Ben wrote: If you're just looking for a way to have high availability and you're ok being tied to linux, DRBD is a good way to go. It keeps things simple in that all changes are replicated, it won't say an fsync is finished until it's finished on the remote host too, Oh

Re: [GENERAL] Data replication through disk replication

2007-05-19 Thread Ben
Er, yes, sorry, I didn't mean to imply that you should run without some kind of STONITH solution, to catch the case when the link DRDB uses goes down but the other network links are still working fine. It's in the common case, when everything is working, that DRBD won't accidentally let you

Re: [GENERAL] Data replication through disk replication

2007-05-19 Thread Joris Dobbelsteen
>-Original Message- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of >Andrew Sullivan >Sent: zaterdag 19 mei 2007 15:28 >To: pgsql-general@postgresql.org >Subject: Re: [GENERAL] Data replication through disk replication > >On Fri, May 18, 2007 at 05:03:30PM -0700, Ben wrot

Re: [GENERAL] Are foreign key's automatically set as indicies?

2007-05-19 Thread PFC
On Wed, 16 May 2007 06:09:15 +0200, camb <[EMAIL PROTECTED]> wrote: Hey all, I'm sorta new to PG and am just wondering, when I create a foreign key is it automatically set as an indexed column or do I need to also set that manually? Primary key creates unique index. Foreign keys do no

Re: [GENERAL] Are foreign key's automatically set as indicies?

2007-05-19 Thread Raymond O'Donnell
On 16/05/2007 05:09, camb wrote: I'm sorta new to PG and am just wondering, when I create a foreign key is it automatically set as an indexed column or do I need to also set that manually? AFAIK you need to create the index separately. I use PgAdmin most of the time, which does that by defaul

[GENERAL] change database encoding without corrupting data (latin9 to utf8)

2007-05-19 Thread filippo
I have a problem to entry data to postgres database (latin9) from my perl/tk application running on windows (utf8). Whenever I try to entry letter with accents, these looks corrupted once stored into database. A workaround is to set client encoding to UTF8 after creating the database connection:

[GENERAL] Committing in a trigger

2007-05-19 Thread Henry
Hi there, I'm using PG 8.2.3. Is it possible to (somehow) commit a specific statement in a trigger function if the function itself is rolled back because of an error (eg, for a unique index error)? For example: create table tab1 (col1 int unique); create table tab2 (col1 int); CREATE OR REP

[GENERAL] Are foreign key's automatically set as indicies?

2007-05-19 Thread camb
Hey all, I'm sorta new to PG and am just wondering, when I create a foreign key is it automatically set as an indexed column or do I need to also set that manually? Thanks in advance, Cam ---(end of broadcast)--- TIP 4: Have you searched our list a

Re: [GENERAL] a few questions on backup

2007-05-19 Thread Marco Colombo
Marco Colombo wrote: > I'll try that out. Maybe my ideas are so far from the truth that I'm > having a hard time in explaing them to people who actually know how > things work. I'll be back with results. Meanwhile, thanks for your time. I think I finally got it. Segment 34 in my pg_xlog got archi

[GENERAL] adding missing FROM-clause entry for table

2007-05-19 Thread Vivian Aguilar
I am porting from 7.4 to 8.1 and i turned off the option to add missing from clause. Is there a way to know How postgres rewritte the queries or add the missing from clause on the postgres log? thank you Vivian ---(end of broadcast)--- TIP 3: H

[GENERAL] FULL JOIN is only supported with merge-joinable join conditions

2007-05-19 Thread Andrus
I try to port application to PostgreSQL 8.1+ The following query runs OK in VFP but causes error in Postgres FULL JOIN is only supported with merge-joinable join conditions How to fix ? Andrus. SELECT ametikoh.Nimetus as ametikoht, Isik.nimi, Isik.eesnimi, koosseis.kogus, COALESCE( iand

[GENERAL] tsearch2 keep throw-away characters

2007-05-19 Thread Kimball
postgres=# select to_tsvector('default','I know how to code in C#, java and C++'); to_tsvector - 'c':7,10 'code':5 'java':8 'know':2 (1 row) postgres=# select to_tsvector('simple','I know how to code in C#, java and C++');

Re: [GENERAL] How to implement GOMONTH function

2007-05-19 Thread Andrus
Thank all very much for great suggestions. I created function CREATE OR REPLACE FUNCTION PUBLIC.GOMONTH(DATE, INTEGER, OUT DATE) IMMUTABLE AS $_$ SELECT ($1 + ($2 * '1 MONTH'::INTERVAL))::DATE; $_$ LANGUAGE SQL; I got errors: function gomonth(date, numeric) does not exist and function gomont

Re: [GENERAL] basic postgres questions...

2007-05-19 Thread woodb
> hey.. . > > can someone point me to the cmds that i'd use in order to see what > databases > are created in my postgres app. i need to see what's here, and then i need > to know the cmd to then delete a given database, and the underlying > tables. from the OS command line, psql -l will list the

Re: [GENERAL] Data replication through disk replication

2007-05-19 Thread Andrew Sullivan
On Fri, May 18, 2007 at 05:03:30PM -0700, Ben wrote: > that all changes are replicated, it won't say an fsync is finished until > it's finished on the remote host too, and it won't let you mount the block > device on the slave system (at least with 0.7x). How can it guarantee these things? Th

[GENERAL] about the pgadmin3

2007-05-19 Thread ee e
my os is Redhat as4,and my postgreSQL is 7.4 , well, when i use pgadmin(windows version1.6.3) to link to the database.the return frame tells me "pg_user doesn't exist" and "pg_settings doesn't exist",how shall handle the problem?

Re: [GENERAL] Fault Tolerant Postgresql (two machines, two postmasters, one disk array)

2007-05-19 Thread Joris Dobbelsteen
>-Original Message- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of Ron Johnson >Sent: donderdag 17 mei 2007 22:56 >To: pgsql-general@postgresql.org >Subject: Re: [GENERAL] Fault Tolerant Postgresql (two >machines, two postmasters, one disk array) > >-BEGIN PGP SIGNED