[Libpqxx-general] Tablewriter: entering specified fields only

Robert Backhaus-pqxx pqxx at robbak.com
Tue May 19 06:20:34 UTC 2009


I am having trouble creating and using a tablewriter to enter data in only
some fields of a table. Replies to this and other lists say it is done by
specifying a list of column names, but I get only crashes.

Given  a table with colums int "machine_id", int "bytecount" and  timestamp
"time" default now(), I would expect to be able to do
tablewriter W(T, "tablename", "id", "data" );, but it segfaults, with the bt
below.

What am I doing wrong?


#0  0x0000000000407110 in pqxx::internal::deref_ptr<char const>::operator()
(
    this=0x7fffffbfe730, i=0x40f000 <Address 0x40f000 out of bounds>)
    at util.hxx:358
358     template<typename T> struct deref_ptr { T operator()(T *i) const
{return *i;} };
[New Thread 0x801b02240 (LWP 100213)]
[New Thread 0x801b020b0 (LWP 100147)]
(gdb) bt
#0  0x0000000000407110 in pqxx::internal::deref_ptr<char const>::operator()
(
    this=0x7fffffbfe730, i=0x40f000 <Address 0x40f000 out of bounds>)
    at util.hxx:358
#1  0x000000000040849d in pqxx::separated_list<char const*,
pqxx::internal::deref_ptr<char const> > (sep=@0x7fffffbfe7a0,
    begin=0x40f000 <Address 0x40f000 out of bounds>, end=0x40dfd8
"bytecount",
    access={<No data fields>}) at util.hxx:382
#2  0x0000000000408553 in pqxx::separated_list<char const> (
    sep=@0x7fffffbfe7a0, begin=0x40dfe2 "machine_id", end=0x40dfd8
"bytecount")
    at util.hxx:402
#3  0x00000000004085ad in pqxx::tablestream::columnlist<char const*> (
    colbegin=0x40dfe2 "machine_id", colend=0x40dfd8 "bytecount")
    at tablestream.hxx:84
#4  0x000000000040870e in tablewriter<const char*> (this=0x7fffffbfebe0,
    T=@0x7fffffbfeb60, WName=@0x7fffffbfecc0,
    begincolumns=0x40dfe2 "machine_id", endcolumns=0x40dfd8 "bytecount")
    at tablewriter.hxx:157
#5  0x00000000004051a8 in postthread (passeddata=0x0) at postthread.cpp:66
#6  0x00000008008d84c1 in pthread_getprio () from /lib/libthr.so.3
#7  0x0000000000000000 in ?? ()
Cannot access memory at address 0x7fffffbff000
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/libpqxx-general/attachments/20090519/5daa1a11/attachment.html 


More information about the Libpqxx-general mailing list