pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Allen <tim@proximity.com.au>
To: dedy <slackman@unika.ac.id>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: faster or ..... ????
Date: Fri, 07 Oct 2005 14:48:34 +1000
Message-ID: <4345FE22.5060707@proximity.com.au> (raw)
In-Reply-To: <20051006045440.18119.qmail@mail.unika.ac.id>
References: <20051006045440.18119.qmail@mail.unika.ac.id>

dedy wrote:
> Hii all,
> I eould like to asking about creating table in postgres

Koq belum ada yg jawab - pada kurang ngerti, kali, Mas :).

> here is the
> 1> can postgres do such things like this one?
>  # create table address as object(address varchar(100), post(6));

post varchar(6), maksudnya, kan? But why the "as object" business - what 
do you expect it to do?

>  # create table id (id integer not null primary key,
>                     name char(100),address);
> now i will
> compare with this one >>
> # create table id (id integer not null primary key, name char(100));
> # create table address (id integer not null references id,
>                       address varchar(100), post(6));

Sudah lihat

http://www.postgresql.org/docs/8.0/interactive/sql-createtable.html

belum? For clarity, you're probably better off mentioning both the table 
and column in the references constraint. And what's post, again? Is it a 
type, or is it a mistyped varchar?

By the way, there isn't usually much point to using varchar(), char() 
etc - just use text; PostgreSQL always stores text efficiently, whatever 
length it is.

> which is most faster???

Faster for what, exactly? It's not clear (to me...) what you think the 
difference between your two alternatives is, except that the first one 
doesn't look like it has any hope of being understood by the database. Eg:

mus=# create table address as object(address varchar(100), post(6));
ERROR:  syntax error at or near "object" at character 25
LINE 1: create table address as object(address varchar(100), post(6)...
                                 ^


> Thank you very much for all your kind to answer my question
> and my english is so bad isn't?

Bahasa Inggrisnya lumayan, dong, cuma bahasa SQL yg wajar diragukan ;-).

> Dedy Styawan
> Semarang

Tim

-- 
-----------------------------------------------
Tim Allen          tim@proximity.com.au
Proximity Pty Ltd  http://www.proximity.com.au/



view thread (3+ messages)

Message-ID: <4345FE22.5060707@proximity.com.au>
Permalink:  ../4345FE22.5060707@proximity.com.au/
Also on:    postgresql.org/message-id/4345FE22.5060707@proximity.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tim@proximity.com.au, slackman@unika.ac.id
  Subject: Re: faster or ..... ????
  In-Reply-To: <4345FE22.5060707@proximity.com.au>
  References: <20051006045440.18119.qmail@mail.unika.ac.id> <4345FE22.5060707@proximity.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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