Re: Custom Insert function

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: "Brian C(dot) Doyle" <bcdoyle(at)mindspring(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Custom Insert function
Date: 2001-09-21 06:08:12
Message-ID: 200109210608.f8L68Ca01506@saturn.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Brian C. Doyle wrote:
> Hello all,
>
> Is it possible to create a function that would look like
> this_function('file.csv');
>
> and make it run
> COPY this_table FROM '/this/location/file.csv' USING DELIMITERS ',';
>
> Thus eliminating alot of repeated work each time???
>
> if so what would I put on the returns

Looks like a job for PL/TclU. It could read an external file,
do all the necessary conversions with Tcl's enhanced regular
expressions and execute inserts unsing a prepared INSERT
plan.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Yeoh 2001-09-21 08:04:32 Does postgresql use /tmp?
Previous Message Karen Ellrick 2001-09-21 06:01:50 Re: Second byte of multibyte characters causing trouble