Thread: Silly Question about varchar(n)

Silly Question about varchar(n)

From
Derek Clarkson
Date:
Hi guys,
    Whats maximum I can put as the length ? - I can't find it in the doco.

Thanks.
--
Derek Clarkson
Web: http://users/bigpond/net/au/drekka


Re: Silly Question about varchar(n)

From
"paul butler"
Date:
From:               Derek Clarkson <dhc@bigpond.net.au>
To:                 pgsql-novice@postgresql.org
Subject:            [NOVICE] Silly Question about varchar(n)
Date sent:          Wed, 29 Jan 2003 17:03:23 +1100


No maximum
(practically, there may be a limit, but I have never exceeded it)
if you use varchar()
otherwise specifed by number, e g varchar(100)
For extra safety and speed use text datatype,
though this may cause odbc hiccups if that is part of your plans
> Hi guys,
>     Whats maximum I can put as the length ? - I can't find it in the doco.
>
> Thanks.
> --
> Derek Clarkson
> Web: http://users/bigpond/net/au/drekka
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

HTH

Paul Butler

Re: Silly Question about varchar(n)

From
Tom Lane
Date:
Derek Clarkson <dhc@bigpond.net.au> writes:
>     Whats maximum I can put as the length ? - I can't find it in the doco.

I think the parser will complain about N exceeding 10,000,000.

In practice, if you don't have a clear idea of what the upper bound
should be, don't put an upper bound --- use type text.  Putting a
meaninglessly large upper bound simply wastes cycles for useless checks.

            regards, tom lane