Re: [SQL] planner used functional index in 7.3.6, now does a seq scan in 7.4.7 after upgrade

2006-11-18 Thread Tom Lane
Chris Tennant <[EMAIL PROTECTED]> writes: > here's the definition of the function (as immutable): > CREATE OR REPLACE FUNCTION stereo_id (INTEGER, INTEGER, INTEGER) RETURNS > INTEGER AS > 'BEGIN RETURN CASE WHEN $2 = $3 THEN $1 ELSE -1 END;END;' >LANGUAGE 'plpgsql' IMMUTABLE; > and

[SQL] planner used functional index in 7.3.6, now does a seq scan in 7.4.7 after upgrade

2006-11-18 Thread Chris Tennant
Greetings, I've just upgraded from 7.3.6 to 7.4.7 (running on Debian Linux). I dumped and reloaded my db as part of the upgrade. Everything is working great, except that one query that executed in < 1 ms on 7.3.6 now takes > 500 ms on 7.4.7. When I look at the query plan, the planner is no

Re: [SQL] How convert UNICODE

2006-11-18 Thread lms
Hi I must copy rows from local database (UNICODE) to remote database SQL_ASCII (not on local machine) with converting selected columns to iso8859_2 or iso_8859_5. Can I make it with COPY? On Sat, 18 Nov 2006 09:42:14 -0500, Travis Whitton wrote > You can use the postgresql COPY command to dump

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread imad
Check this one http://archives.postgresql.org/pgsql-patches/2004-04/msg00280.php I have not personally worked on what is described in this page but someone will correct you in the community if anything is going wrong here. --Imad www.EnterpriseDB.com On 11/19/06, Rajesh Kumar Mallah <[EMAIL P

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread Rajesh Kumar Mallah
On 11/19/06, Tom Lane <[EMAIL PROTECTED]> wrote: "Rajesh Kumar Mallah" <[EMAIL PROTECTED]> writes: > In our webapps, we use the same username to connect to the database > for all kind of updates. Hence we are not able to makeout whoo modified > what . However at application level we have differe

Re: [SQL] Random()

2006-11-18 Thread Rajesh Kumar Mallah
On 11/18/06, A. Kretschmer <[EMAIL PROTECTED]> wrote: am Sat, dem 18.11.2006, um 23:02:33 +0530 mailte Rajesh Kumar Mallah folgendes: > >select from order by random() limit 1; > > This query will tend to get slower as the table grows because of the > sorting. Right. > > it possible to get

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread Tom Lane
"Rajesh Kumar Mallah" <[EMAIL PROTECTED]> writes: > In our webapps, we use the same username to connect to the database > for all kind of updates. Hence we are not able to makeout whoo modified > what . However at application level we have different "userid" for different > users of the system. we

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread Volkan YAZICI
Hi, On Nov 18 06:00, Rajesh Kumar Mallah wrote: > Is there any way to set a variable from a web application (using > dbi/perl , libpq etc), and access the same variable from a C trigger > inside a transaction ? Also you may consider using a sequence for storing an integer value. This approach wil

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread Rajesh Kumar Mallah
On 11/18/06, Volkan YAZICI <[EMAIL PROTECTED]> wrote: Hi, On Nov 18 06:00, Rajesh Kumar Mallah wrote: > Is there any way to set a variable from a web application (using > dbi/perl , libpq etc), and access the same variable from a C trigger > inside a transaction ? Why don't you use a temporary

Re: [SQL] Random()

2006-11-18 Thread A. Kretschmer
am Sat, dem 18.11.2006, um 23:02:33 +0530 mailte Rajesh Kumar Mallah folgendes: > >select from order by random() limit 1; > > This query will tend to get slower as the table grows because of the > sorting. Right. > > it possible to get a row from a random offset > how about > > select fr

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread Volkan YAZICI
Hi, On Nov 18 06:00, Rajesh Kumar Mallah wrote: > Is there any way to set a variable from a web application (using > dbi/perl , libpq etc), and access the same variable from a C trigger > inside a transaction ? Why don't you use a temporary table for that purpose? Regards.

Re: [SQL] Random()

2006-11-18 Thread Rajesh Kumar Mallah
On 11/17/06, A. Kretschmer <[EMAIL PROTECTED]> wrote: am Thu, dem 16.11.2006, um 16:31:14 -0200 mailte Ezequias Rodrigues da Rocha folgendes: > Hi list, > > I have a bigint collumn and I would like to generate a random number within the > numbers of my column. select from order by random()

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread Rajesh Kumar Mallah
hi, We do not want to modify our apps for doing auditing. we are considering table level auditing auditrail http://gborg.postgresql.org/project/audittrail/projdisplay.php seems to be doing a good job. i just need to access the "username" that starts the transaction in webapp from the trigger in a

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread imad
Why dont you try to make 'username' part of your query. While auditing updates and inserts, the username can be some how made a part of the tuple being inserted. Just a thought! --Imad www.EnterpriseDB.com On 11/18/06, Rajesh Kumar Mallah <[EMAIL PROTECTED]> wrote: Hi , Is there any way to se

[SQL] transactional shared variable in postgresql

2006-11-18 Thread Rajesh Kumar Mallah
Hi , Is there any way to set a variable from a web application (using dbi/perl , libpq etc), and access the same variable from a C trigger inside a transaction ? the %_SHARED hash available in plperl provides only session level isolation and does not suit the requirement. Original problem: we