Re: [SQL] Indices and user defined operators

2005-06-08 Thread Tom Lane
I wrote: > "Dmitri Bichko" <[EMAIL PROTECTED]> writes: >> So, is there any way to make these operators use an index defined as >> above? > If you've set things up so that the operators are defined by inline-able > SQL functions, I'd sort of expect it to fall out for free ... Here's a quick proof-

Re: [SQL] Indices and user defined operators

2005-06-08 Thread Tom Lane
"Dmitri Bichko" <[EMAIL PROTECTED]> writes: > So, is there any way to make these operators use an index defined as > above? If you've set things up so that the operators are defined by inline-able SQL functions, I'd sort of expect it to fall out for free ... regards, tom l

[SQL] Indices and user defined operators

2005-06-08 Thread Dmitri Bichko
Being lazy, I've created a set of case incensitive text comparison operators: =*, <*, >*, and !=*; the function for each just does an UPPER() on both arguments and then uses the corresponding builtin operator. What would make these REALLY useful, is if when running something like: SELECT * FROM f

Re: [SQL] SELECT very slow

2005-06-08 Thread Alain
Tom Lane escreveu: Thomas Kellerer <[EMAIL PROTECTED]> writes: Is there anything I can do, to convince PG to return the first row more quickly? Are you now looking for the LIMIT ? SELECT * FROM table LIMIT 1; and when when you wnat the rest of it: SELECT * FROM table OFFSET 1; Alain --

Re: [SQL] SELECT very slow

2005-06-08 Thread Tom Lane
Thomas Kellerer <[EMAIL PROTECTED]> writes: > Is there anything I can do, to convince PG to return the first row more > quickly? libpq's API for PQresult is such that it really doesn't have any choice but to collect the full result set before it hands you back the PQresult. I don't know JDBC ver

[Fwd: RE: Re: [SQL] Rule]

2005-06-08 Thread Keith Worthington
Personally I feel that if this individual can't be bothered to white list the postgresql.org domain they should be banned from the list. Kind Regards, Keith Original Message Subject:RE: Re: [SQL] Rule Date: Wed, 8 Jun 2005 19:02:39 -0300 (BRT) From: AntiSpam UOL <[

Re: [SQL] Rule

2005-06-08 Thread Keith Worthington
David wrote: What I want to do is setup some kind of rule so that whenever a s_data field is updated, that the time_stamp gets update to the current time/date. Normally you want to do that with a before trigger rather than a rule. Ok, I have no knowledge of Tiggers except what I just read i

[SQL] SELECT very slow

2005-06-08 Thread Thomas Kellerer
Hello, I have a table with roughly 100,000 rows (four varchar(100) columns). This is basically test data I generated for something else. I'm using JDBC to access PG (but the behaviour is the same with psql). The problem is, that a SELECT * FROM foobar; takes ages (roughly 3 minutes) to retur

Re: [SQL] Rule

2005-06-08 Thread David Hofmann
Ok, I have no knowledge of Tiggers except what I just read in the docs section. Look like I need to make a procudure then call it with a trigger. Is there a better location for Tigger/Procudure Examples. The trigger seems fairly, however I got lost in the procudure part. David Normally you

Re: [SQL] Rule

2005-06-08 Thread Bruno Wolff III
On Wed, Jun 08, 2005 at 15:51:35 -0400, David Hofmann <[EMAIL PROTECTED]> wrote: > > What I want to do is setup some kind of rule so that whenever a s_data > field is updated, that the time_stamp gets update to the current time/date. Normally you want to do that with a before trigger rather t

[SQL] Rule

2005-06-08 Thread David Hofmann
I have a table with 3 fields, id, s_data, and time_stamp. The time_stamp field is set to now() by deault. The program that uses this table only uses the id and s_data file. I added and use the time_stamp field to delete old records after a certain time. What I want to do is setup some kind

Re: [SQL] plpgsql dynamic record access

2005-06-08 Thread Rajesh Kumar Mallah
Ganesh, Did you have a look at example Example 35-2. A PL/pgSQL http://www.postgresql.org/docs/current/static/plpgsql-trigger.html Regds maLLAH ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] access to new/old in dynamic sql for audit table

2005-06-08 Thread Tom Lane
Jay Parker <[EMAIL PROTECTED]> writes: > I am revisiting the age-old audit table issue, and am curious to see > whether I can get away with not writing custom trigger functions for > every table being audited. You can't do it nohow in plpgsql. I believe it's relatively simple in pltcl or plperl

[SQL] access to new/old in dynamic sql for audit table

2005-06-08 Thread Jay Parker
I am revisiting the age-old audit table issue, and am curious to see whether I can get away with not writing custom trigger functions for every table being audited. My design has a foo_audit schema for each schema foo containing tables to be audited, so triggers on foo.bar will insert rows int

Re: [SQL] Cursor need it?

2005-06-08 Thread KÖPFERL Robert
| |I am a new postgres user | |I want to get a list of tables from pg_tables where tables are like |‘%wo%’ (for example).. and then query that list …. | |Select count(*) from tableVARIABLENAMEFROMFIRSTQUERY | |In SQL SERVER I can do that using cursor but in postgresql I don’t |understand how to

Re: [SQL] How do write a query...

2005-06-08 Thread Bruno Wolff III
Please keep replies copied to the list unless you have a specific reason not to. This will help you get help and will help other people learn from the discussion. On Wed, Jun 08, 2005 at 13:56:36 +0200, Alain <[EMAIL PROTECTED]> wrote: > > In fact, these are results of analyses. For one patient

[SQL] Cursor need it?

2005-06-08 Thread Lucas Hernndez
I am a new postgres user I want to get a list of tables from pg_tables where tables are like ‘%wo%’ (for example).. and then query that list …. Select count(*) from tableVARIABLENAMEFROMFIRSTQUERY In SQL SERVER I can do that using cursor but in postgresql I don’t understand how to use cursor

[SQL] Experience with splitting a Table transparently

2005-06-08 Thread KÖPFERL Robert
Hi, I'm looking for people who have got experience at splitting a table with heavy records into two relations. In my case there exists one table with the mentioned heavy records. These are processed by a statemachine. Thus a bunch of columns gets changed several times in the livetime of one recor