Обсуждение: What is wrong?
Hi there. I wrote a simple postgresql sql function as follows:
create function test() returns integer as '
begin
fixed_path := translate (''/text'', ''\\'', ''/'');
raise notice ''fixed_path:'', fixed_path;
return 1;
end
' language 'plpgsql';
And when I ran it as
pgsql>select test();
I got:
NOTICE: plpgsql: ERROR during compile of test near line 8
ERROR: unterminated string starting on line 10
What is wrong? (something fishy about translate function?) Could anyone
enlighten me on this?
Thank you very much!
Wei
On 28 Sep 2001, Wei Weng wrote:
> Hi there. I wrote a simple postgresql sql function as follows:
>
> create function test() returns integer as '
> begin
> fixed_path := translate (''/text'', ''\\'', ''/'');
> raise notice ''fixed_path:'', fixed_path;
> return 1;
> end
> ' language 'plpgsql';
>
> And when I ran it as
>
> pgsql>select test();
>
> I got:
>
> NOTICE: plpgsql: ERROR during compile of test near line 8
> ERROR: unterminated string starting on line 10
>
> What is wrong? (something fishy about translate function?) Could anyone
> enlighten me on this?
I think you need to use four backslashes to do the quoting for the
backslash. Plus you're going to need to declare that variable.
Hi all,
Let's say I have a table named "info" having the following fields:
name char(40),
surname char(40),
address char(40),
id serial
Now, since id is a serial, while inserting data into info I write:
INSERT INTO info (name,surname,address) VALUES ('$name','$surname',
'#address');
Is there a shorter way of doing this? I mean, if I had 40 fields in this
table, would I have to write all the fields? I mean, is there a syntax
beginning like
INSERT INTO info VALUES (....
?
Regards and best wishes,
Love, respect,sharing,Linux and PostgreSQL
--
Devrim GÜNDÜZ
Web & System Administrator ---- Web ve Sistem Yoneticisi (www.oper.metu.edu.tr)
devrim@oper.metu.edu.tr
devrimg@tr.net
Phone : +90-535-328-9594 (cellular)
Phone : +90-312-295-9595 (work : 09:00/17:00 on weekdays+Saturday)
Phone : +90-312-286-5906 (home)
http://devrim.oper.metu.edu.tr
------------------------------------------------------------------