Re: Syntax question

From: David Helgason <david(at)uti(dot)is>
To: Tony Li <tony(dot)li(at)tony(dot)li>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Syntax question
Date: 2004-07-07 01:15:52
Message-ID: 3085D088-CFB3-11D8-80DF-000A9566DA8A@uti.is
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

(forgot to reply on-list the first time around)

On 7. jul 2004, at 02:28, Tony Li wrote:
> On Jul 6, 2004, at 4:51 PM, David Helgason wrote:
>> On 7. jul 2004, at 00:42, Tony Li wrote:
>>> I'm trying to write an application to allow a user to edit an
>>> arbitrary table.
>>> How can I determine the type of a particular field and figure out
>>> whether or
>>> not I should be quoting the value?
>>
>> You can always quote a value (or just usually?) in PostgreSQL, even
>> numbers, so it shouldn't be a problem. The database will throw an
>> error if the value you sent in can't be coerced into the right type,
>> and that error you can forward to your user. I.e.
>>
>> create table delme (foo integer, bar text);
>> insert into delme (foo, bar) values ('11', 'fru');
>>
> Thanks, but one of my "requirements" is that the user never has to
> type quotes, so
> I have to figure this out.

I see, but if your app just always adds quotes, you'll be allright. See
my example above.

> Tony

David Helgason,
Over the Edge Entertainment
(makers of the Unity 3d-engine http://otee.dk)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jerry LeVan 2004-07-07 01:41:58 Loading Binary Data into Bytea Fields?
Previous Message Greg Sabino Mullane 2004-07-07 01:02:02 Re: SUBSTRING for a regular expression