mirror of
https://github.com/dimitri/pgloader.git
synced 2026-01-22 15:41:03 +01:00
The PostgreSQL COPY protocol requires an explicit initialization phase that may fail, and in this case the Postmodern driver transaction is already dead, so there's no way we can even send ABORT to it. Review the error handling of our copy-batch function to cope with that fact, and add some logging of non-retryable errors we may have. Also improve the thread error reporting when using a binary image from where it might be difficult to open an interactive debugger, while still having the full blown Common Lisp debugging experience for the project developers. Add a test case for a missing column as in issue #339. Fix #339, see #337.
101 lines
2.7 KiB
Makefile
101 lines
2.7 KiB
Makefile
TMPDIR ?= /tmp
|
|
TESTS = $(wildcard *.load)
|
|
OUT = $(TESTS:.load=.out)
|
|
|
|
REMOTE = archive.load bossa-all.load bossa.load census-places.load dbf-zip.load
|
|
LOCAL = $(filter-out $(REMOTE:.load=.out),$(OUT))
|
|
REGRESS= allcols.load \
|
|
csv-before-after.load \
|
|
csv-districts.load \
|
|
csv-parse-date.load \
|
|
csv-error.load \
|
|
csv-escape-mode.load \
|
|
csv-filename-pattern.load \
|
|
csv-header.load \
|
|
csv-json.load \
|
|
csv-keep-extra-blanks.load \
|
|
csv-missing-col.load \
|
|
csv-non-printable.load \
|
|
csv-nulls.load \
|
|
csv-temp.load \
|
|
csv-trim-extra-blanks.load \
|
|
csv.load \
|
|
copy.load \
|
|
copy-hex.load \
|
|
dbf.load \
|
|
errors.load \
|
|
fixed.load \
|
|
fields-with-periods.load \
|
|
ixf.load \
|
|
overflow.load \
|
|
partial.load \
|
|
serial.load \
|
|
udc.load \
|
|
xzero.load
|
|
|
|
PGLOADER ?= ../build/bin/pgloader
|
|
|
|
regress: clean-out $(addprefix regress/out/, $(REGRESS:.load=.out)) ;
|
|
|
|
clean-out:
|
|
rm -f regress/out/*
|
|
|
|
local: prepare $(LOCAL)
|
|
|
|
remote: prepare $(REMOTE:.load=.out)
|
|
|
|
all: prepare $(OUT)
|
|
|
|
prepare: bossa.sql sakila
|
|
-dropdb -U postgres pgloader
|
|
-dropdb -U postgres stocks
|
|
-dropdb -U postgres ip4r
|
|
-createdb -U postgres -O `whoami` pgloader
|
|
-createdb -U postgres -O `whoami` stocks
|
|
-createdb -U postgres -O `whoami` ip4r
|
|
-psql -d pgloader -c 'create schema expected'
|
|
-psql -U postgres -d pgloader -c 'create extension ip4r'
|
|
-psql -U postgres -d ip4r -c 'create extension ip4r'
|
|
-psql -d stocks -f bossa.sql
|
|
|
|
errors.out: errors.load
|
|
-$(PGLOADER) $<
|
|
@echo
|
|
|
|
nofile.out: nofile.load
|
|
-$(PGLOADER) $<
|
|
@echo
|
|
|
|
csv-hstore.out: csv-hstore.load
|
|
@echo skipping $@
|
|
|
|
# sakila needs preparing a MySQL database too
|
|
$(TMPDIR)/sakila-db/sakila-schema.sql: data/sakila-db.zip
|
|
rm -rf $(TMPDIR)/sakila-db
|
|
unzip $< -d $(TMPDIR)
|
|
|
|
sakila: $(TMPDIR)/sakila-db/sakila-schema.sql
|
|
-dropdb -U postgres sakila
|
|
-createdb -U postgres -O `whoami` sakila
|
|
-echo "DROP DATABASE sakila" | mysql -u root
|
|
echo "SOURCE $(TMPDIR)/sakila-db/sakila-schema.sql" | mysql -u root
|
|
echo "SOURCE $(TMPDIR)/sakila-db/sakila-data.sql" | mysql -u root
|
|
|
|
sakila.out: sakila sakila.load
|
|
-$(PGLOADER) sakila.load
|
|
@echo
|
|
|
|
csv-districts-stdin.out: csv-districts-stdin.load
|
|
cat data/2013_Gaz_113CDs_national.txt | $(PGLOADER) $^
|
|
|
|
# General case where we do NOT expect any error
|
|
%.out: %.load
|
|
$(PGLOADER) $<
|
|
@echo
|
|
|
|
# Regression tests
|
|
regress/out/%.out: %.load
|
|
#./regress.sh $(PGLOADER) $<
|
|
$(PGLOADER) --regress $<
|
|
touch $@
|