Skip site navigation (1) Skip section navigation (2)

Re: Porting from Mysql to Postgres

From: Bob Kline <bkline(at)rksystems(dot)com>
To: Dror Matalon <dror(at)matal(dot)com>
Cc: PostgreSQL jdbc list <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Porting from Mysql to Postgres
Date: 2001-02-01 19:50:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
On Thu, 1 Feb 2001, Dror Matalon wrote:

> 1. When I insert a CHAR field and then fetch it, I find out that the
> server padded it with spaces to the size of the field.

This is correct behavior, according to the SQL standard.

> This happens in Postgres but not in MySQL.

Actually, it happens in MySQL, too, sometimes, but it's not always easy
to predict intuitively when it will happen.

> I'm using String.trim() on it on the Java side. Is there a better
> way to do this, like setting a flag to tell the server to trim?

You could use VARCHAR instead of CHAR, but the approach you're using is
probably fine, because most (all?) Java runtimes perform that operation
very efficiently, without any unnecessary allocation/copying.

Bob Kline

In response to

pgsql-jdbc by date

Next:From: Kovacs BaldvinDate: 2001-02-01 20:39:51
Subject: Q on JDBC's resultset
Previous:From: Dror MatalonDate: 2001-02-01 18:41:18
Subject: Porting from Mysql to Postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group