[TinyOWS-users] value out of range for type integer

Gissur Þórhallsson gissur at loftmyndir.is
Wed Sep 28 06:01:00 EST 2011


I have an update and fix for my issue - my workaround was keeping me from
opening the table in qgis (as postgis connection not WFS) due to the data
type of the primary key (bigint) so I decided to give fixing it the old
college try.

After upgrading to 1.0.0rc4 and setting LOG_LEVEL to SQL I noticed that
tinyows was calling the postgresql function *pg_get_serial_sequence* and
getting a null result.

This was due to some table juggling hanky panky I'd pulled while updating
the data which left the sequence in the ownership by an older table which
I'd replaced by renaming it and sticking the update in it's place (a
terrible practice, I realize).

I had the sequence specified as the DEFAULT value for the column, but *
pg_get_serial_sequence* acutally returns sequences* OWNED BY* table.column
which was not the case.

This caused tinyOWS to 'helpfully' fabricate huge numbers for the primary

Anyway, after a simple*
 ALTER SEQUENCE "my_table_gid_seq" OWNED BY my_table.gid;
*command, all fell into place.

I'm not sure whether this is bug or not, but perhaps it should be more
natural for tinyOWS to return an error if the following is true:

   - Column has a NOT NULL constraint
   - No sequence can be found for said column
   - No value was provided

Fabricating values in the face of these conditions seems unwise.

But I might be missing something.

Anyway, just thought I'd throw this out there in case anybody ever stumbles
onto this thread with a similar issue.

Kind regards from Iceland,

2011/8/24 Gissur Þórhallsson <gissur at loftmyndir.is>

> Hi Olivier,
> (Sorry for the late reply - been on holiday.)
> Yeah - that works - except that it doesn't address the fact that tinyOWS
> shouldn't be inserting into the gid field at all.
> I don't specify it anywhere and I have a sequence on the database side
> that's supposed to take care of it.
> Also: this seems to happen when I mess around with the table I'm inserting
> into (I had just restored from a backup when this suddenly popped up).
> Even though changing the type to bigint does "fix" it - using 8 an byte
> integer to store something that could easily be stored using 4 bytes just
> really bugs me :)
> Kind regards,
> Gissur
> On Thu, Aug 4, 2011 at 11:07 AM, Olivier Courtin <
> olivier.courtin at gmail.com> wrote:
>> Hi Gissur,
>> Pastebin works now for theses samples as i recheck now,
>> Workaround could be simple as changing type in database from int to bigint
>> Something like:
>> ALTER TABLE jukka ALTER COLUMN column_name TYPE bigint;
>> HTH,
>> --
>> Olivier
>> _______________________________________________
>> TinyOWS-users mailing list
>> TinyOWS-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/tinyows-users
> --
> Gissur Þórhallsson
> Loftmyndir ehf.
> Laugavegur 13
> IS 101 Reykjavík - Iceland
> sími (tel): (+354) 540 2500
> tölvupóstur (email): gissur at loftmyndir.is

Gissur Þórhallsson

Loftmyndir ehf.
Laugavegur 13
IS 101 Reykjavík - Iceland
sími (tel): (+354) 540 2500
tölvupóstur (email): gissur at loftmyndir.is
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/tinyows-users/attachments/20110928/204f8e5c/attachment.htm 

More information about the TinyOWS-users mailing list