[SQL] Run Function With First Priority

2007-11-20 Thread Otniel Michael
Dear All, 

How i can run function with first priority on postgres?

In my case, when i run function that need a lot of time. Then the other person 
run the other function, i think my function run on the below priority of the 
other function.

Thanks.
 
-- 
 "He who is quick to become angry will commit folly, and a crafty man is hated" 
 





  

Be a better sports nut!  Let your teams follow you 
with Yahoo Mobile. Try it now.  
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ

[SQL] Loading 8.2 data into 8.1

2007-11-20 Thread Andreas Joseph Krogh
Hi.
Is it considered "safe" to use 8.1's pg_dump to dump an 8.2-db and load it 
into 8.1?

-- 
Andreas Joseph Krogh <[EMAIL PROTECTED]>
Senior Software Developer / Manager
+-+
OfficeNet AS| The most difficult thing in the world is to |
Karenslyst Allé 11  | know how to do a thing and to watch |
PO. Box 529 Skøyen  | somebody else doing it wrong, without   |
0214 Oslo   | comment.|
NORWAY  | |
Tlf:+47 24 15 38 90 | |
Fax:+47 24 15 38 91 | |
Mobile: +47 909  56 963 | |
+-+

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


[SQL] dynmic column names inside trigger?

2007-11-20 Thread Louis-David Mitterrand
Hi,

I've got this trigger to clean up text entered in web forms:

CREATE or replace FUNCTION sanitize_text() RETURNS "trigger"
AS $$
declare
begin
if old.story is not null and new.story != old.story
then
new.story = translate(new.story, E'\x92\x96', '''-');
new.story = regexp_replace(new.story, E'\x9c', 'oe', 
'g');
new.story = regexp_replace(new.story, E'\x85', '...', 
'g');
end if;
return new;
end;
$$
LANGUAGE plpgsql;


CREATE TRIGGER sanitize_text_trig
BEFORE INSERT or update ON story
FOR EACH ROW
EXECUTE PROCEDURE sanitize_text();


I'd like to use it on other tables an columns but how can the column 
name be dynamic inside the procedure. Passing the column name in the 
trigger declaration and using it as NEW.TG_ARGV[0] seems out of the 
question.

Is there another solution out there?

Thanks,

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [SQL] dynmic column names inside trigger?

2007-11-20 Thread Tom Lane
Louis-David Mitterrand <[EMAIL PROTECTED]> writes:
> I'd like to use it on other tables an columns but how can the column 
> name be dynamic inside the procedure.

It can't --- plpgsql has no support for that.  You could probably make
it work in some of the other PL languages, such as plperl or pltcl,
which are less strongly typed.

regards, tom lane

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] [ODBC] string function

2007-11-20 Thread Phillip Smith
Hi,

 

I don't believe the LEFT function exists (at least by default).

 

Try this instead:

select SUBSTR(kd_aln,LENGTH(kd_aln) - 1, 2) as code from airlin

 

Also, please don't cross-post. This isn't an ODBC question. You're more
likely to get useful answers posting once to the correct list.

 

Cheers,

~p

 



THINK BEFORE YOU PRINT - Save paper if you don't really need to print this

***Confidentiality and Privilege Notice***

The material contained in this message is privileged and confidential to
the addressee.  If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments
e-mail.