Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] Determine data type of columns

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: "Bryan White" <bryan(at)arcamax(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] Determine data type of columns
Date: 1998-11-11 09:56:29
Message-ID: l03110701b26f0f0c4c43@[147.233.159.109] (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-interfaces
At 23:21 +0200 on 10/11/98, Bryan White wrote:


> I have a general purpose utilty for entering data into web based forms.  The
> function that parses the data and inserts the record into a table is largely
> unaware of the structure of the table it is operating on.  I am currenly
> having problems with integer fields.  If I blindly quote all fields the back
> end will complain about casting on integer fields.  Also I would like to do
> some primitive field validation based on type before submitting to the back
> end.

It may be worth noticing that if you use COPY rather than INSERT, you don't
have to quote neither numbers nor other data types. You do have to quote
delimiter characters (tab, newline, backslash - or whatever you chose as
your copy delimiters) with a backslash. That can be easily done even with
the most "blind" front end, which knows nothing about the fields.

I know, I know. You want to do updates and some type-based data checking as
well. But this may be the answer in cases you don't, and be faster at that.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



In response to

pgsql-interfaces by date

Next:From: Herouth MaozDate: 1998-11-11 11:44:22
Subject: Re: [INTERFACES] how to obtain column info
Previous:From: Brett McCormickDate: 1998-11-11 05:33:15
Subject: Re: [INTERFACES] how to obtain column info

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group