in reply to GeoIP revisited
Just a thought: you could insert a 'IF NOT EXISTS'-create just before the TRUNCATE-statement so that the program 'Just Works' if the table isn't there.
$dbh->do(" CREATE TABLE IF NOT EXISTS geoip ( netblock cidr NOT NULL, country_code text NOT NULL, country_name text NOT NULL, CONSTRAINT geoip_pk PRIMARY KEY (netblock) );" ) or die($dbh->errstr);
IF NOT EXISTS was added to CREATE TABLE long ago and all supported versions of postgres support it.
(I removed the oids- and tablespace-stuff, as I didn't need that.)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: GeoIP revisited
by cavac (Parson) on Nov 27, 2018 at 14:04 UTC |
In Section
Cool Uses for Perl