The similarities and differences between DB2 and PostgreSQL development

Source: Internet
Author: User
Tags definition db2 db2 client error code postgresql postgresql client

This article mainly introduces the DB2 database development and PostgreSQL development in the actual operation of some of the similarities, and the difference, recently used DB2, wrote a point of difference. Not necessarily exactly right. But you can look at the difference.

1, Data Definition language (DDL) and peripheral tools: the difference between DB2 and PostgreSQL is almost 0, the specific difference is:

A, DB2 varchar in the absence of special table space, the upper limit for the 32k,postgresql varchar without this restriction;

B, DB2 binary large object type blob, replaced by Bytea type in PostgreSQL;

C, DB2 text large object type CLOB, long varchar, in PostgreSQL with the text type instead;

D, in DB2 generated by default or generated always type key word in PostgreSQL instead of serial or bigserial; (the difference is the largest)

E, there is no sequence (sequence object) in the DB2, the PostgreSQL is there, thus more flexible;

The value reset of the DB2 primary key in F, in the PostgreSQL requires ALTER TABLE, and the Setval () series function can be used to set the sequence, simpler;

G, DB2 does not support spatial data types (dots, lines, faces), PostgreSQL support;

The transaction isolation level definition in H, DB2 is not compatible with the SQL Standard, PostgreSQL fully compatible with SQL standard;

I, DB2 JDBC Type4 driver does not support GBK database coding, PostgreSQL does not have this problem;

J,DB2 's database code conversion is very funny and complex, PostgreSQL is very simple, only need set client_encoding to xxx;

K, currently DB2 8.1 does not support Unicode background encoding, PostgreSQL support, so it can support multiple internal code;

The trigger of L,DB2 8.1 cannot read the data table being triggered, PostgreSQL does not have this restriction;

M,DB2 8.1 Triggers cannot execute the stored procedure, PostgreSQL does not have this restriction;

The n,postgresql has bit (bit), bitstring (bit string) type, DB2 not;

O,DB2 client Db2/db2cmd Execute SQL script needs to specify delimiters, such as @;p Ostgresql client default is semicolon;

P,DB2 client db2/db2cmd has no command history function, PostgreSQL client has, can edit history command;

Q,DB2 cannot install different database versions on the same machine, PostgreSQL can;

R,DB2 has the concept of a federal database, PostgreSQL does not;

S,DB2 II can replicate heterogeneous databases, and PostgreSQL needs to develop its own software;

T,DB2 8.1 There is no good way to back up the entire database into a text script, PostgreSQL easy;

Java stored procedure overloads for U,DB2 8.1 need to restart the database, PostgreSQL not required;

V,DB2 the SQL command in the client db2/db2cmd can not be saved by using a folded line, PostgreSQL;

W,DB2 No Chinese documents, PostgreSQL and complete;

X,DB2 has a relatively complete error code, PostgreSQL is not complete at present;

Call function required in Y,DB2: select Func () from Sysibm.sysdummy1,postgresql only need: select Func (); Can

A stored procedure or function writing that returns a result set in Z,DB2 is very complex, requiring additional tablet storage of the result set, with the addition of a return Next statement in PostgreSQL;

There is no Rowtype/record type concept for stored procedures in A,DB2, PostgreSQL;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.