Re: Syntax question - Mailing list pgsql-general

From David Helgason
Subject Re: Syntax question
Date
Msg-id 3085D088-CFB3-11D8-80DF-000A9566DA8A@uti.is
Whole thread Raw
In response to Syntax question  (Tony Li <tony.li@tony.li>)
List 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)


pgsql-general by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: SUBSTRING for a regular expression
Next
From: Jerry LeVan
Date:
Subject: Loading Binary Data into Bytea Fields?