pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Porting problem from Informix to Postgres...
6+ messages / 4 participants
[nested] [flat]

* Porting problem from Informix to Postgres...
@ 2004-09-21 15:42 Marco Gaiarin <gaio@sv.lnf.it>
  0 siblings, 0 replies; 6+ messages in thread

From: Marco Gaiarin @ 2004-09-21 15:42 UTC (permalink / raw)
  To: pgsql-sql


[sorry, i'm think i'm missing something very simple, so i've not
subscribed to this list... i'll read the answers on web archive, but if
you want put me on CC... thanks!]

On our organization we are porting an old, internally developed app,
that use Informix (SE 7.XX, on a sun box) as database backend and Gupta
Centura Team Developer 1.5.1 as development environment.

Centura uses Informix via a native driver, for postgres we pass along
odbc. Our postgres environment are a set of intel box, loaded with
debian woody, so postgres 7.2.1.

We have solved many problem, i've also make a little perl script that
convert a informix's dbexport dump into a set of file suitable to
import into postgres.


Now we are moving the app... we was happy, because seems that the only
modification needed was to alter some of the more complex query,
because of the difference on informix and postgres sql dialects.


But a big problem now arise: at the very beginning of this app, there
was a bug in handling of date in centura, so the guys circumvent this
converting all date in strings, and handle ``manually''.
Not sufficient, they don't do this with a wrapper function around date
field, but with ``casting'' data in varchar in the selects (with select
... into ...) and only local computation.
It's dumb, i know. ;(


So now, on informix, a set of centura statement like:

	Call SqlPrepareAndExecute(hsql,'select dt_fatt from fatture into :una')
	Call SqlFetchNext(hsql,err)

make on string/variable :una a date like:

	'01-08-2001'

for january 8, 2001, but on postgres we got:

	'2001-01-08'


There's a way to alter globally the date format (apart PGDATESTYLE
variable, just tried with no luck), or there's a way to setup query to have
the correct date format?

I've tried to use the mailing list search robots, but looking for
informix on this list (and on -general) make nothing. ;(


Many thanks.

-- 
dott. Marco Gaiarin				    GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                http://www.sv.lnf.it/
  Polo FVG  -  Via della Bontà, 7 - 33078  -  San Vito al Tagliamento (PN)
  gaio(at)sv.lnf.it		tel +39-0434-842711    fax +39-0434-842797

    			Urbani, dimissioni please
		http://punto-informatico.it/p.asp?i=49171



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Porting problem from Informix to Postgres...
@ 2004-09-22 12:17 Marco Gaiarin <gaio@sv.lnf.it>
  2004-09-22 11:48 ` Re: Porting problem from Informix to Postgres... Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2004-09-22 12:34 ` Re: Porting problem from Informix to Postgres... Michalis Kabrianis <lists@interzone.gr>
  2004-09-22 17:16 ` Re: Porting problem from Informix to Postgres... Josh Berkus <josh@agliodbs.com>
  2004-09-29 13:21 ` Re: Porting problem from Informix to Postgres... Marco Gaiarin <gaio@sv.lnf.it>
  0 siblings, 4 replies; 6+ messages in thread

From: Marco Gaiarin @ 2004-09-22 12:17 UTC (permalink / raw)
  To: pgsql-sql


On our organization we are porting an old, internally developed app,
that use Informix (SE 7.XX, on a sun box) as database backend and Gupta
Centura Team Developer 1.5.1 as development environment.

Centura uses Informix via a native driver, for postgres we pass along
odbc. Our postgres environment are a set of intel box, loaded with
debian woody, so postgres 7.2.1.

We have solved many problem, i've also make a little perl script that
convert a informix's dbexport dump into a set of file suitable to
import into postgres.


Now we are moving the app... we was happy, because seems that the only
modification needed was to alter some of the more complex query,
because of the difference on informix and postgres sql dialects.


But a big problem now arise: at the very beginning of this app, there
was a bug in handling of date in centura, so the guys circumvent this
converting all date in strings, and handle ``manually''.
Not sufficient, they don't do this with a wrapper function around date
field, but with ``casting'' data in varchar in the selects (with select
... into ...) and only local computation.
It's dumb, i know. ;(


So now, on informix, a set of centura statement like:

	Call SqlPrepareAndExecute(hsql,'select dt_fatt from fatture into :una')
	Call SqlFetchNext(hsql,err)

make on string/variable :una a date like:

	'01-08-2001'

for january 8, 2001, but on postgres we got:

	'2001-01-08'


There's a way to alter globally the date format (apart PGDATESTYLE
variable, just tried with no luck), or there's a way to setup query to have
the correct date format?

I've tried to use the mailing list search robots, but looking for
informix on this list (and on -general) make nothing. ;(


Many thanks.

-- 
dott. Marco Gaiarin				    GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                http://www.sv.lnf.it/
  Polo FVG  -  Via della Bontà, 7 - 33078  -  San Vito al Tagliamento (PN)
  gaio(at)sv.lnf.it		tel +39-0434-842711    fax +39-0434-842797

    			Urbani, dimissioni please
		http://punto-informatico.it/p.asp?i=49171



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Porting problem from Informix to Postgres...
  2004-09-22 12:17 Porting problem from Informix to Postgres... Marco Gaiarin <gaio@sv.lnf.it>
@ 2004-09-22 11:48 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
  3 siblings, 0 replies; 6+ messages in thread

From: Achilleus Mantzios @ 2004-09-22 11:48 UTC (permalink / raw)
  To: Marco Gaiarin <gaio@sv.lnf.it>; +Cc: pgsql-sql

O Marco Gaiarin Ýãñáøå óôéò Sep 22, 2004 :

> 
> On our organization we are porting an old, internally developed app,
> that use Informix (SE 7.XX, on a sun box) as database backend and Gupta
> Centura Team Developer 1.5.1 as development environment.
> 
> Centura uses Informix via a native driver, for postgres we pass along
> odbc. Our postgres environment are a set of intel box, loaded with
> debian woody, so postgres 7.2.1.
> 
> We have solved many problem, i've also make a little perl script that
> convert a informix's dbexport dump into a set of file suitable to
> import into postgres.
> 
> 
> Now we are moving the app... we was happy, because seems that the only
> modification needed was to alter some of the more complex query,
> because of the difference on informix and postgres sql dialects.
> 
> 
> But a big problem now arise: at the very beginning of this app, there
> was a bug in handling of date in centura, so the guys circumvent this
> converting all date in strings, and handle ``manually''.
> Not sufficient, they don't do this with a wrapper function around date
> field, but with ``casting'' data in varchar in the selects (with select
> ... into ...) and only local computation.
> It's dumb, i know. ;(
> 
> 
> So now, on informix, a set of centura statement like:
> 
> 	Call SqlPrepareAndExecute(hsql,'select dt_fatt from fatture into :una')
> 	Call SqlFetchNext(hsql,err)
> 
> make on string/variable :una a date like:
> 
> 	'01-08-2001'
> 
> for january 8, 2001, but on postgres we got:
> 
> 	'2001-01-08'

Just a dummy workaround (i am sure you'll find something better),

dynacom=# SET DateStyle TO German ;
SET
dynacom=# SELECT replace(now()::date::text,'.','-');
  replace
------------
 22-09-2004



> 
> 
> There's a way to alter globally the date format (apart PGDATESTYLE
> variable, just tried with no luck), or there's a way to setup query to have
> the correct date format?
> 
> I've tried to use the mailing list search robots, but looking for
> informix on this list (and on -general) make nothing. ;(
> 
> 
> Many thanks.
> 
> 

-- 
-Achilleus




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Porting problem from Informix to Postgres...
  2004-09-22 12:17 Porting problem from Informix to Postgres... Marco Gaiarin <gaio@sv.lnf.it>
@ 2004-09-22 12:34 ` Michalis Kabrianis <lists@interzone.gr>
  3 siblings, 0 replies; 6+ messages in thread

From: Michalis Kabrianis @ 2004-09-22 12:34 UTC (permalink / raw)
  To: Marco Gaiarin <gaio@sv.lnf.it>; +Cc: pgsql-sql

Marco Gaiarin wrote:
> On our organization we are porting an old, internally developed app,
> that use Informix (SE 7.XX, on a sun box) as database backend and Gupta
> Centura Team Developer 1.5.1 as development environment.
> 
> Centura uses Informix via a native driver, for postgres we pass along
> odbc. Our postgres environment are a set of intel box, loaded with
> debian woody, so postgres 7.2.1.
> 
> We have solved many problem, i've also make a little perl script that
> convert a informix's dbexport dump into a set of file suitable to
> import into postgres.
> 
> 
> Now we are moving the app... we was happy, because seems that the only
> modification needed was to alter some of the more complex query,
> because of the difference on informix and postgres sql dialects.
> 
> 
> But a big problem now arise: at the very beginning of this app, there
> was a bug in handling of date in centura, so the guys circumvent this
> converting all date in strings, and handle ``manually''.
> Not sufficient, they don't do this with a wrapper function around date
> field, but with ``casting'' data in varchar in the selects (with select
> ... into ...) and only local computation.
> It's dumb, i know. ;(
> 
> 
> So now, on informix, a set of centura statement like:
> 
> 	Call SqlPrepareAndExecute(hsql,'select dt_fatt from fatture into :una')
> 	Call SqlFetchNext(hsql,err)
> 
> make on string/variable :una a date like:
> 
> 	'01-08-2001'
> 
> for january 8, 2001, but on postgres we got:
> 
> 	'2001-01-08'
> 
> 
> There's a way to alter globally the date format (apart PGDATESTYLE
> variable, just tried with no luck), or there's a way to setup query to have
> the correct date format?
> 

Wouldn't
set datestyle to postgres; (or something else, try iso,mdy, I think it 
depends on your locale) do the trick?
You can also try to put it in postgresql.conf if I'm not wrong

Michalis

 > I've tried to use the mailing list search robots, but looking for
 > informix on this list (and on -general) make nothing. ;(
 >
 >
 > Many thanks.
 >



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Porting problem from Informix to Postgres...
  2004-09-22 12:17 Porting problem from Informix to Postgres... Marco Gaiarin <gaio@sv.lnf.it>
@ 2004-09-22 17:16 ` Josh Berkus <josh@agliodbs.com>
  3 siblings, 0 replies; 6+ messages in thread

From: Josh Berkus @ 2004-09-22 17:16 UTC (permalink / raw)
  To: Marco Gaiarin <gaio@sv.lnf.it>; +Cc: pgsql-sql

Marco,

> Centura uses Informix via a native driver, for postgres we pass along
> odbc. Our postgres environment are a set of intel box, loaded with
> debian woody, so postgres 7.2.1.

You do realize that this is a 2-year-old version of Postgresql, yes?  It seems 
to me that if you're going to take the trouble of porting an application, you 
should port it to something current -- Debian Stable or not.   Particularly 
since, in a year, you can expect that the PostgreSQL community will probably 
stop doing security/stability patches for 7.2.

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Porting problem from Informix to Postgres...
  2004-09-22 12:17 Porting problem from Informix to Postgres... Marco Gaiarin <gaio@sv.lnf.it>
@ 2004-09-29 13:21 ` Marco Gaiarin <gaio@sv.lnf.it>
  3 siblings, 0 replies; 6+ messages in thread

From: Marco Gaiarin @ 2004-09-29 13:21 UTC (permalink / raw)
  To: Jeff <threshar@torgo.978.org>; pgsql-sql

Mandi! Jeff
  In chel di` si favelave...

> 1. use to_char to format the date however you like

...this seems the best solution, many thanks to all! ;)

-- 
dott. Marco Gaiarin				    GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                http://www.sv.lnf.it/
  Polo FVG  -  Via della Bontà, 7 - 33078  -  San Vito al Tagliamento (PN)
  gaio(at)sv.lnf.it		tel +39-0434-842711    fax +39-0434-842797

    			Urbani, dimissioni please
		http://punto-informatico.it/p.asp?i=49171



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2004-09-29 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-21 15:42 Porting problem from Informix to Postgres... Marco Gaiarin <gaio@sv.lnf.it>
2004-09-22 12:17 Porting problem from Informix to Postgres... Marco Gaiarin <gaio@sv.lnf.it>
2004-09-22 11:48 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2004-09-22 12:34 ` Michalis Kabrianis <lists@interzone.gr>
2004-09-22 17:16 ` Josh Berkus <josh@agliodbs.com>
2004-09-29 13:21 ` Marco Gaiarin <gaio@sv.lnf.it>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox