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

Re: insert fail gracefully if primary key already exists

From: Bartosz Dmytrak <bdmytrak(at)eranet(dot)pl>
To: Alessandro Gagliardi <alessandro(at)path(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: insert fail gracefully if primary key already exists
Date: 2012-02-11 08:08:04
Message-ID: CAD8_UcZFC2bez4W3ujs-DZh5MdgLO79TA=1-Q_JB=ucN71z0kg@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Could You provide more details?
PostgreSQL does not allow cross database queries.


Regards,
Bartek

2012/2/10 Alessandro Gagliardi <alessandro(at)path(dot)com>

> I have a situation where I am gradually filling in a table from another
> database as the need requires. As it currently is, whenever a record comes
> up, it tries to insert it into my database. If the row is already there,
> the primary key collides and the insert fails. And that's fine except that
> it makes for a really cluttered log (making it hard to find errors that I
> really do need to pay attention to). I'm wondering if there's a better
> (i.e. cleaner, but possibly also more efficient) way to do this.
>
> Thoughts?
>
> Thank you in advance,
> -Alessandro
>

In response to

Responses

pgsql-novice by date

Next:From: JORGE MALDONADODate: 2012-02-12 00:13:51
Subject: HTML encode/decode
Previous:From: lmanordersDate: 2012-02-10 22:29:29
Subject: Using libpq 8.4 with PostgreSQL 9.1

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