Thread: Bug: Inserting

Bug: Inserting

From
kimmol@duniversum.com (Kimmo Lahdensivu)
Date:
If PostgreSQL failed to compile on your computer or you found a bug that
is likely to be specific to one platform then please fill out this form
and e-mail it to pgsql-ports@postgresql.org.

To report any other bug, fill out the form below and e-mail it to
pgsql-bugs@postgresql.org.

If you not only found the problem but solved it and generated a patch
then e-mail it to pgsql-patches@postgresql.org instead.  Please use the
command "diff -c" to generate the patch.

You may also enter a bug report at http://www.postgresql.org/ instead of
e-mail-ing this form.

============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name        : Kimmo Lahdensivu
Your email address    : kimmol@tulppaani.com


System Configuration
---------------------
  Architecture (example: Intel Pentium)      :   Intel Pentium Xeon III 500MHz x2 SMP

  Operating System (example: Linux 2.0.26 ELF)     :   Linux 2.2.13 ELF

  PostgreSQL version (example: PostgreSQL-6.5.2):   PostgreSQL-6.5.3

  Compiler used (example:  gcc 2.8.0)        :   gcc 2.7.2.3


Please enter a FULL description of your problem:
------------------------------------------------

The problem is that in some situations postgresql doesn't store the data it
receives. So, for example, if I make a normal INSERT statement the row supposed
to appear in the database isn't there. This has happened only in situation
where there are at least 20 tables in the database. The database files are
not corrupted. I made a dump of the database and moved the database to
another system with clean postgresql installation and the same happened
trying to insert to the table.

There was one common thing to all the situations I was unable to insert.
They were made using postgresql library of php3 (3.0.9). There were no
error messages or anything but the data just didn't appear in the db.
I solved this problem quick & dirty way by executing psql from the php
script with the statement as a parameter of it. It worked well but now
I have one table that it doesn't work with. The effect is the same as
with php. Everything seems to be fine but the data isn't there.

I run postmaster in debug mode in one console to see if there was something
worth seeing. The output of the debug was exactly the same in cases where
the data disappeared and when it got stored in the db. No error messages.

The problem has been at least in versions 6.3, 6.4 & 6.5.

Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------



If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------



Re: [BUGS] Bug: Inserting

From
Tom Lane
Date:
kimmol@duniversum.com (Kimmo Lahdensivu) writes:
> There was one common thing to all the situations I was unable to insert.
> They were made using postgresql library of php3 (3.0.9). There were no
> error messages or anything but the data just didn't appear in the db.

I think PHP is one of the interfaces that has "autocommit" control (a
seriously misnamed feature IMHO).  What this really means is that your
changes *don't* get committed until you say so, because the interface
library issues a BEGIN WORK behind-your-back.  If you disconnect without
having done the correct incantation to cause a COMMIT, presto: all your
work is rolled back.

I don't know PHP well enough to know the magic incantation, however...

            regards, tom lane

Re: [BUGS] Bug: Inserting

From
kimmol@duniversum.com (Kimmo Lahdensivu)
Date:
> kimmol@duniversum.com (Kimmo Lahdensivu) writes:
> > There was one common thing to all the situations I was unable to insert.
> > They were made using postgresql library of php3 (3.0.9). There were no
> > error messages or anything but the data just didn't appear in the db.
>
> I think PHP is one of the interfaces that has "autocommit" control (a
> seriously misnamed feature IMHO).  What this really means is that your
> changes *don't* get committed until you say so, because the interface
> library issues a BEGIN WORK behind-your-back.  If you disconnect without
> having done the correct incantation to cause a COMMIT, presto: all your
> work is rolled back.
>
> I don't know PHP well enough to know the magic incantation, however...

No. This is not the problem. At the current situation I'm not able to
insert a row into the table. It fails constantly without any error
messages and even if I call "psql -c "Insert statement" dbase" from
the php script without using the php interface. This is not a problem
appearing sometimes but all the time after it has first happened.

'' Kimmo