Re: Errors on CREATE TABLE IF NOT EXISTS - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: Errors on CREATE TABLE IF NOT EXISTS
Date
Msg-id 1335900770-sup-854@alvh.no-ip.org
Whole thread Raw
In response to Errors on CREATE TABLE IF NOT EXISTS  (Matteo Beccati <php@beccati.com>)
Responses Re: Errors on CREATE TABLE IF NOT EXISTS
List pgsql-bugs
Excerpts from Matteo Beccati's message of lun abr 23 08:49:39 -0300 2012:
> Hi,
>=20
> I've recently seen a few errors on our continuous integration system=20
> during a test using a badly written partitioning trigger. The function=20
> was basically checking for the existence of the partition table at every=
=20
> insert and was running a CREATE TABLE IF NOT EXISTS statement in case it=
=20
> was needed. What baffled me was that the function was exiting with an=20
> ERROR, rather than succeeding with a NOTICE, e.g.:

The question you were asking has already been answered, but I think it's
worth pointing out that a partitioned-insert trigger that has to check
whether the partition exist beforehand is a lot slower than one that
doesn't have to.  Our usual suggestion is to create the partitions by
some other means, e.g. create a couple months worth of weekly
partitions, a couple of months ahead of time, via cron.  The insert
trigger is then assured that the partition exists, and it can become
faster by not having to check.

--=20
=C3=81lvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-bugs by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: BUG #6623: FATAL: terminating connection due to administrator command
Next
From: stuart@stuartbishop.net
Date:
Subject: BUG #6624: Tab completion of identifier containing single backslash triggers warnings