Re: [GENERAL] Simple stored procedure examples?

2006-11-05 Thread Shane Ambler
novnov wrote: I would really prefer it if simple names like Item and ItemName not be double quoted. You're saying that postgres itself would only require double quotes if the table was originally decribed that way (and it is, being created by pgAdmin). Seems like an odd mismatch between pgsql an

Re: [GENERAL] Simple stored procedure examples?

2006-11-05 Thread Martijn van Oosterhout
On Sun, Nov 05, 2006 at 08:51:52AM -0800, novnov wrote: > I would really prefer it if simple names like Item and ItemName not be > double quoted. You're saying that postgres itself would only require double > quotes if the table was originally decribed that way (and it is, being > created by pgAdmi

Re: [GENERAL] Simple stored procedure examples?

2006-11-05 Thread novnov
Hmm well that's interesting. I had posted to the pgAdmin list too re this issue, thinking that the quotes issues was something with that interface to pgsql. There I was told "PostgreSQL does require you to use double quotes in some circumstances (for example, if you use upper case letters). pgAd

Re: [GENERAL] Simple stored procedure examples?

2006-11-05 Thread Martijn van Oosterhout
On Sat, Nov 04, 2006 at 08:35:28AM -0800, novnov wrote: > So pgSQL is case sensitive and that include keywords like UPDATE and SET. No it's not. Only identifiers in double quotes (") are case-sensetive. So, in your example below, because the function was created with double quotes, you now have t

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread novnov
Thanks again everyone. I thought pgSQL might be case sensitive so I tried all variations (mentioned all of this in prev msgs) Oh...I just figured out what it was. I did created the proc successfully. The pgAdmin III interface saved it, moved it from the procedures hive to the functions hive. Eac

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread Stephan Szabo
On Sat, 4 Nov 2006, novnov wrote: > > Thanks to both of you for responding. I should have included the code for my > own attempt, at #1 which is just as you suggest: > > update item set itemname = 'fox'; > > I've tried single, and double quoting the table and field names; call caps > to the UPDATE

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread Mikko Partio
> novnov wrote: Thanks to both of you for responding. I should have included the code for my own attempt, at #1 which is just as you suggest: update item set itemname = 'fox'; I've tried single, and double quoting the table and field names; call caps to the UPDATE etc, exactly matching the cap

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread Oisin Glynn
novnov wrote: And here is what shows in the SQL window for that proceedure CREATE FUNCTION "proc_UpdateItemName"(IN "strItemName" "varchar") RETURNS void AS $BODY$update item set itemname = 'fox';$BODY$ LANGUAGE 'sql' VOLATILE; The error is always "ERROR relation "item" does not exist". Not us

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread novnov
And here is what shows in the SQL window for that proceedure CREATE FUNCTION "proc_UpdateItemName"(IN "strItemName" "varchar") RETURNS void AS $BODY$update item set itemname = 'fox';$BODY$ LANGUAGE 'sql' VOLATILE; The error is always "ERROR relation "item" does not exist". Not using the param,

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread novnov
Thanks to both of you for responding. I should have included the code for my own attempt, at #1 which is just as you suggest: update item set itemname = 'fox'; I've tried single, and double quoting the table and field names; call caps to the UPDATE etc, exactly matching the capitalization of the

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread Stephan Szabo
On Fri, 3 Nov 2006, novnov wrote: > I'm completely new to pgsql, using 8.1 and pgAdmin III. I'm not finding a lot > of bare bones simple example stored procs that I can learn from. It would be > very helpful if someone could show me some simple code. > > In the pgAdmin interface I've been picking

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread Shoaib Mir
You can use the following:>>#1 updating ItemName for all rows to 'fox'update tablename set itemname = 'fox';>>#2 updating ItemName for row where ItemID = 2 to 'fox'update tablename set itemname = 'fox' where itemid = 2; >>#3 updating ItemName for row where ItemID = 3 to a param value passed in\set

[GENERAL] Simple stored procedure examples?

2006-11-03 Thread novnov
I'm completely new to pgsql, using 8.1 and pgAdmin III. I'm not finding a lot of bare bones simple example stored procs that I can learn from. It would be very helpful if someone could show me some simple code. In the pgAdmin interface I've been picking SQL as the language, that's the default it