No title

Started by Ricardo Caesar Lenzialmost 25 years ago1 messagesbugs
Jump to latest
#1Ricardo Caesar Lenzi
ricardo@k1.com.br

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

Your name : Ricardo Caesar Lenzi
Your email address : ricardo@k1.com.br

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium

Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.16 (Conectiva Linux)

PostgreSQL version (example: PostgreSQL-7.1.1): PostgreSQL-7.2devel

Compiler used (example: gcc 2.95.2) : 2.91.66

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

All the postgres functions, when using python interface, returns values
in wrong data type, text instead integer or float.

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

Table structure:

ricardo=# \d contato
Table "contato"
Column | Type | Modifiers
------------+---------+-------------------------------------
id_contato | integer | default nextval('contato_id'::text)
nome | text |
fone1 | text |
fone2 | text |
email | text |
Indexes: contato_ix1,
contato_ix2

Python program, using postgresql-7.1.3 server:

[ricardo@ricardo ricardo]$ python
Python 1.5.2 (#1, Jun 18 2000, 03:54:39) [GCC egcs-2.91.66 19990314/Linux]
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam

import pg
db=pg.connect("ricardo")
c=db.query("select count(*) from contato").getresult()[0][0]
print repr(c), type(c)

'27' <type 'string'>

c=db.query("select sum(id_contato) from contato").getresult()[0][0]
print repr(c), type(c)

'475' <type 'string'>

c=db.query("select nextval('contato_id')").getresult()[0][0]
print repr(c), type(c)

'1' <type 'string'>

Python program, using postgresql-7.1.2 server:

[ricardo@ricardo ricardo]$ python
Python 1.5.2 (#1, Jun 18 2000, 03:54:39) [GCC egcs-2.91.66 19990314/Linux]
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam

import pg
db=pg.connect("ricardo")
c=db.query("select count(*) from contato").getresult()[0][0]
print repr(c), type(c)

27 <type 'int'>

c=db.query("select sum(id_contato) from contato").getresult()[0][0]
print repr(c), type(c)

475 <type 'int'>

c=db.query("select nextval('contato_id')").getresult()[0][0]
print repr(c), type(c)

1 <type 'int'>

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