Re: Newbie: PG8 and text file parsing

Поиск
Список
Период
Сортировка
От Sim Zacks
Тема Re: Newbie: PG8 and text file parsing
Дата
Msg-id cv9au1$2f43$1@news.hub.org
обсуждение исходный текст
Ответ на Newbie: PG8 and text file parsing  (Paul R <blueaxon@gmail.com>)
Список pgsql-general
You can always do an insert and add a trigger that checks the key for
existence. If it exists do the update instead.
That way you have one line of code doing both inserts and updates.

The only problem with it is that it looks confusing from an outsiders
perspective, so it would have to be documented very well.

Sim


"Paul R" <blueaxon@gmail.com> wrote in message
news:3eb42da105021817342feb0b2d@mail.gmail.com...
> I need some advice.. I am new to PG8 - I am working on the project
> that needs to load data daily to PostgreSQL from the text file.. the
> text file is 40MB comma delimited file with row consisting of 20-30
> fields and couple thousands of rows..
>
> so the data needs to be parsed and if the row exists it needs to be
> updated, otherwise new record is going to be created. My problem is
> with parsing:
>
> 1-what would be a good approach to do it? is plpgSQL suitable for
> this? or should I use PHP or other language to to that and run as a
> cron job/service?
>
> 2-how about committing transactions?  would there be a problem if it
> is done at the end of all the updates?
>
> Thank you
> Paul
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>



В списке pgsql-general по дате отправления:

Предыдущее
От: strk@refractions.net
Дата:
Сообщение: Re: [postgis-users] postgresql8.0 and postgis1.0.0
Следующее
От: Tony Caduto
Дата:
Сообщение: Re: is there anyway to get the backends IP address from