dbTalk Databases Forums  

[BUGS] Two small patches to improve dbf2pg

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Two small patches to improve dbf2pg in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Pitt
 
Posts: n/a

Default [BUGS] Two small patches to improve dbf2pg - 10-06-2005 , 01:39 PM







--zhXaljGHf11kAtnf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi PostgreSQL developers!

A long time ago some Debian user sent me two patches to improve the
dbf2pg conversion tool (in contrib). These are applied in the Debian
packages for quite a while now without any problems. I forwarded them
here some time ago already, but just let's try again. :-)

The first patch (52-contrib-dbf2pg-errorcheck.patch) improves error
checking. It checks the result status of PQexec() for the cases that
it returns a reply (i. e. not NULL) which indicates an error.

The second patch (53-contrib-dbf2pg-textfield.patch) adds support for
dBase's "M" field which translates to PostgreSQL's "text" data type.

They are not Debian specific in any way and probably useful for all
other users, too. Can you please consider applying them upstream?

Thanks in advance!

Martin

--=20
Martin Pitt http://www.piware.de
Ubuntu Developer http://www.ubuntu.com
Debian Developer http://www.debian.org

In a world without walls and fences, who needs Windows and Gates?

--zhXaljGHf11kAtnf
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDRW5MDecnbV4Fd/IRAmHKAJ9YpWNV5Z8m5np06K8pNrnC+bIcwgCgnuXb
eqsn0gpVFr3Xm6j2VTgmTbc=
=Pu9L
-----END PGP SIGNATURE-----

--zhXaljGHf11kAtnf--

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Two small patches to improve dbf2pg - 10-06-2005 , 06:15 PM






Martin Pitt <martin (AT) piware (DOT) de> writes:
Quote:
A long time ago some Debian user sent me two patches to improve the
dbf2pg conversion tool (in contrib). These are applied in the Debian
packages for quite a while now without any problems. I forwarded them
here some time ago already, but just let's try again. :-)

The first patch (52-contrib-dbf2pg-errorcheck.patch) improves error
checking. It checks the result status of PQexec() for the cases that
it returns a reply (i. e. not NULL) which indicates an error.

The second patch (53-contrib-dbf2pg-textfield.patch) adds support for
dBase's "M" field which translates to PostgreSQL's "text" data type.
Applied with minor editorialization.

regards, tom lane

Index: dbf2pg.c
================================================== =================
RCS file: /cvsroot/pgsql/contrib/dbase/dbf2pg.c,v
retrieving revision 1.23
diff -c -r1.23 dbf2pg.c
*** dbf2pg.c 24 Sep 2005 19:14:03 -0000 1.23
--- dbf2pg.c 6 Oct 2005 23:03:34 -0000
***************
*** 301,306 ****
--- 301,309 ----
case 'L':
strcat(query, " char");
break;
+ case 'M':
+ strcat(query, " text");
+ break;
}
}

***************
*** 312,318 ****
printf("%s\n", query);
}

! if ((res = PQexec(conn, query)) == NULL)
{
fprintf(stderr, "Error creating table!\n");
fprintf(stderr, "Detailed report: %s\n", PQerrorMessage(conn));
--- 315,322 ----
printf("%s\n", query);
}

! if ((res = PQexec(conn, query)) == NULL ||
! PQresultStatus(res) != PGRES_COMMAND_OK)
{
fprintf(stderr, "Error creating table!\n");
fprintf(stderr, "Detailed report: %s\n", PQerrorMessage(conn));

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.