Re: Simple stored procedure examples?

From: Mikko Partio <dun(at)paprikalaatikko(dot)be>
To: novnov <novnovice(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Simple stored procedure examples?
Date: 2006-11-04 16:15:47
Message-ID: 454CBCB3.7000808@paprikalaatikko.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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 capitalization of the table and
>> field names (really Item and ItemName).
>>
>> I wonder if "Item" is a reserved word in pgsql?
>>
>>

I think you haven't quoted the field names correctly.

dun=# CREATE TABLE "Item" (id int4, "ItemName" text);
CREATE TABLE
dun=# INSERT INTO "Item" VALUES(1,'aaa');
INSERT 0 1
dun=# UPDATE "Item" SET "ItemName" = 'fox';
UPDATE 1
dun=# SELECT * FROM "Item";
id | ItemName
----+----------
1 | fox
(1 row)

If you want to have case-sensitive names, you have to have double quotes.

MP

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-11-04 16:34:30 Re: UNICODE and UTF-8
Previous Message Oisin Glynn 2006-11-04 16:03:12 Re: Simple stored procedure examples?