| From: | "William ZHANG" <uniware(at)zedware(dot)org> |
|---|---|
| To: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: 7.4: CHAR padding inconsistency |
| Date: | 2003-11-20 05:09:42 |
| Message-ID: | bphjj2$10st$1@news.hub.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs pgsql-hackers |
Bruce said:
> How do other databases handle this?
I have tried on MS SQL Server 2000 and Oracle 9i for Windows.
SQL Server doesn't like character_length and || , so use len and + instead.
Oracle doesn't like character_length either, use length.
Hope the result may help.
create table chartest(col char(10) not null);
insert into chartest values ('AAA');
PostgreSQL:
select character_length(col) from chartest;
10
SQL Server
select len(col) from chartest;
3
Oracle
select length(col) from chartest;
10
PostgreSQL:
select character_length(col || 'hey') from chartest;
6
SQL Server:
select len(col + 'hey') from chartest;
13
Oracle:
select length(col || 'hey') from chartest;
13
PostgreSQL:
select 'aaa ' || 'bb';
aaa bb
SQL Server:
select 'aaa ' + 'bb';
aaa bb
Oracle:
select 'aaa ' || 'bb' from dual;
aaa bb
PostgreSQL:
select cast('aa ' as char(10)) || 'b';
aab
SQL Server:
select cast('aa ' as char(10)) + 'b';
aa b
Oracle:
select cast('aa ' as char(10)) || 'b' from dual;
aa b
| From | Date | Subject | |
|---|---|---|---|
| Next Message | jerry | 2003-11-20 05:12:35 | Re: IpcSemaphoreCreate: semget(...) failed: No space left on device |
| Previous Message | jerry | 2003-11-20 01:37:10 | IpcSemaphoreCreate: semget(...) failed: No space left on device |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2003-11-20 05:32:08 | Re: [HACKERS] Not 7.5, but 8.0 ? |
| Previous Message | Tom Lane | 2003-11-20 04:36:30 | Re: commenting on polymorphic aggregates possible? |