Re: [SQL] Function returns error (view)

2008-02-26 Thread Bart Degryse
How do you call your function? You should call it like this: SELECT * FROM seach_password('Flavio'); Replace Flavio with the login of someone in table_user. Also watch out for the function name: if you copied my suggestion it is seach_... and not search_... I would also suggest you replace the

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Edward W. Rouse
Could it be that the insert statement itself is the problem? What does the table look like? Edward W. Rouse -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bart Degryse Sent: Tuesday, February 26, 2008 11:35 AM To: pgsql-sql@postgresql.org; Shavonn

Re: [SQL] Function returns error (view)

2008-02-26 Thread Professor Flávio Brito
Hi After I did it I received it ERROR: set-valued function called in context that cannot accept a set SQL state: 0A000 Context: PL/pgSQL function "seach_password(" line 14 at return next Error at WHERE login= USER_FOO ?? Thanks for your help Flávio 2008/2/26, Bart Degryse <[EMAIL PROTECTED]>:

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Rodrigo E. De León Plicet
On Tue, Feb 26, 2008 at 11:36 AM, Shavonne Marietta Wijesinghe <[EMAIL PROTECTED]> wrote: > BEGIN > SAVEPOINT s1; > ... code here ... > EXCEPTION > WHEN ... THEN > ROLLBACK TO s1; > ... code here ... > WHEN ... THEN > ROLLB

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Alvaro Herrera
Shavonne Marietta Wijesinghe wrote: > I wrote the query in the SQL windows provided by the pgadmin. That SQL window only executes SQL, so you can't use PL/pgSQL commands on it. PL/pgSQL can only be used in the context of a PL/pgSQL function, so you need to do CREATE FUNCTION to do that. If you w

Re: [SQL] Function returns error (view)

2008-02-26 Thread Bart Degryse
I think you have a quoting problem You want something like WHERE login= 'Flavo' But you're making something like WHERE login = Flavo Something like this should work... CREATE OR REPLACE FUNCTION seach_password(USER_FOO IN table_user.login%TYPE) RETURNS SETOF vw_change_password AS $BODY$ DECL

Re: [SQL] Function returns error (view)

2008-02-26 Thread Professor Flávio Brito
Hi Colin When I translated from Portuguese to English I forgot a letter, but using the corrected name I received an error. 2008/2/26, Colin Wetherbee <[EMAIL PROTECTED]>: > > Professor Flávio Brito wrote: > > When I Test my view I receive > > > > SELECT seach_password('user_login_foo') > > [

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Shavonne Marietta Wijesinghe
I wrote the query in the SQL windows provided by the pgadmin. According to the examples in "Chapter 35. PL/pgSQL - SQL Procedural Language" i don't see what i did different. BEGIN SAVEPOINT s1; ... code here ... EXCEPTION WHEN ... THEN ROLLBACK TO s1;

Re: [SQL] Function returns error (view)

2008-02-26 Thread Colin Wetherbee
Professor Flávio Brito wrote: When I Test my view I receive SELECT seach_password('user_login_foo') [...] ERROR: column "user_login_foo" does not exist SQL state: 42703 Context: PL/pgSQL function "search_password" line 14 at for over execute statement seach_password and search_password are

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Bart Degryse
Shavonne, You will probably always find someone on the list who will answer your questions, but you really should read the manual too! In this case you could have found the answer by reading http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING >>> "Shav

[SQL] Function returns error (view)

2008-02-26 Thread Professor Flávio Brito
Hi Don't know why I can't receive a return like my view fields (I'm newbie in plpgsql). Postgresql returns me a erro . How can I received a answer like my view structure? When I Test my view I receive SELECT seach_password('user_login_foo') My view returns me 25746;"MARCELO ";"bio1";"bio1";"2

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Teemu Torma
On Tuesday 26 February 2008, Andrew Sullivan wrote: > Well, except that there's no "EXCEPTION" statement in SQL?  I think > your correspondent was intending for this to be programmatic. I was thinking pl/pgsql. Teemu ---(end of broadcast)--- TIP

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Andrew Sullivan
On Tue, Feb 26, 2008 at 05:05:01PM +0100, Shavonne Marietta Wijesinghe wrote: > Thank you. I tried as you said. But i get a ERROR: syntax error at or near > "INSERT" at character 9 > I don't see anything wrong with the code.. Well, except that there's no "EXCEPTION" statement in SQL? I think

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Shavonne Marietta Wijesinghe
Thank you. I tried as you said. But i get a ERROR: syntax error at or near "INSERT" at character 9 BEGIN INSERT INTO my_shevi values ('a', 4, 2, 2); EXCEPTION WHEN unique_violation THEN INSERT INTO my_shevi values ('a', 5, 2, 2); END; I don't see anything wrong with the code.. Shavonne -

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Teemu Torma
On Tuesday 26 February 2008, Shavonne Marietta Wijesinghe wrote: > During an "INSERT INTO" I get an "Error - duplicate key violates > unique constraint" > > Is there any way, that i can test the error. Something like this?? > > IF error = "duplicate key violates unique constraint" then >     do

[SQL] duplicate key violates unique constraint

2008-02-26 Thread Shavonne Marietta Wijesinghe
Hello During an "INSERT INTO" I get an "Error - duplicate key violates unique constraint" Is there any way, that i can test the error. Something like this?? IF error = "duplicate key violates unique constraint" then do something else insert into end if Thanks Shavonne

Re: [SQL] Deploying PostgreSQL on virtualized hardware

2008-02-26 Thread TJ O'Donnell
I've been running PostgreSQL on a virtual server for several years now. I'm using VMWare with a Windows host and Linux guest. I've configured it to let Linux use a raw partition as a disk. Before I used a separate partition, the virtual disk had been a Windows file. Using the disk partition in