pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Column data type in doc example may be changed to VARCHAR from TEXT
4+ messages / 3 participants
[nested] [flat]

* Column data type in doc example may be changed to VARCHAR from TEXT
@ 2024-07-18 05:10 Muhammad Ikram <mmikram@gmail.com>
  2024-07-18 05:17 ` Re: Column data type in doc example may be changed to VARCHAR from TEXT David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Muhammad Ikram @ 2024-07-18 05:10 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org

Hi,

IMHO, a minor issue in the doc. As a good practice we use TEXT data type
when we expect longer text e.g. comments, doc kind of columns.
For columns where we know what can be a maximum Text size though variable,
we use VARCHAR to limit accidental long text or for other worthy reasons.

Following example may be revised.

*From*

CREATE TABLE products (
    product_no integer,
    name text,
    price numeric
);

*To*

CREATE TABLE products (
    product_no integer,
    name varchar(expected length),
    price numeric
);

Muhammad Ikram,

Bitnine Global.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Column data type in doc example may be changed to VARCHAR from TEXT
  2024-07-18 05:10 Column data type in doc example may be changed to VARCHAR from TEXT Muhammad Ikram <mmikram@gmail.com>
@ 2024-07-18 05:17 ` David G. Johnston <david.g.johnston@gmail.com>
  2024-07-18 05:22   ` Re: Column data type in doc example may be changed to VARCHAR from TEXT Muhammad Ikram <mmikram@gmail.com>
  2024-07-18 05:28   ` Re: Column data type in doc example may be changed to VARCHAR from TEXT Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 4+ messages in thread

From: David G. Johnston @ 2024-07-18 05:17 UTC (permalink / raw)
  To: Muhammad Ikram <mmikram@gmail.com>; +Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

On Wednesday, July 17, 2024, Muhammad Ikram <mmikram@gmail.com> wrote:

>
>
> IMHO, a minor issue in the doc. As a good practice we use TEXT data type
> when we expect longer text e.g. comments, doc kind of columns.
>

Who is we in this conversation?  If it’s the documentation please reference
existing work.  Text is our preferred type and we are fairly consistent in
using it to my knowledge.

David J.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Column data type in doc example may be changed to VARCHAR from TEXT
  2024-07-18 05:10 Column data type in doc example may be changed to VARCHAR from TEXT Muhammad Ikram <mmikram@gmail.com>
  2024-07-18 05:17 ` Re: Column data type in doc example may be changed to VARCHAR from TEXT David G. Johnston <david.g.johnston@gmail.com>
@ 2024-07-18 05:22   ` Muhammad Ikram <mmikram@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Muhammad Ikram @ 2024-07-18 05:22 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

Thanks David for clarifying. I am coming from an Oracle background, so
there we(developers) mostly use CHAR or VARCHAR2 data types for such
identifiers instead of CLOB.
Sorry for my naiveness about PostgreSQL doc practices.

Regards,
Muhammad Ikram
Bitnine global.


On Thu, Jul 18, 2024 at 10:17 AM David G. Johnston <
david.g.johnston@gmail.com> wrote:

> On Wednesday, July 17, 2024, Muhammad Ikram <mmikram@gmail.com> wrote:
>
>>
>>
>> IMHO, a minor issue in the doc. As a good practice we use TEXT data type
>> when we expect longer text e.g. comments, doc kind of columns.
>>
>
> Who is we in this conversation?  If it’s the documentation please
> reference existing work.  Text is our preferred type and we are fairly
> consistent in using it to my knowledge.
>
> David J.
>


-- 
Muhammad Ikram

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Column data type in doc example may be changed to VARCHAR from TEXT
  2024-07-18 05:10 Column data type in doc example may be changed to VARCHAR from TEXT Muhammad Ikram <mmikram@gmail.com>
  2024-07-18 05:17 ` Re: Column data type in doc example may be changed to VARCHAR from TEXT David G. Johnston <david.g.johnston@gmail.com>
@ 2024-07-18 05:28   ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 4+ messages in thread

From: Tom Lane @ 2024-07-18 05:28 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Muhammad Ikram <mmikram@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wednesday, July 17, 2024, Muhammad Ikram <mmikram@gmail.com> wrote:
>> IMHO, a minor issue in the doc. As a good practice we use TEXT data type
>> when we expect longer text e.g. comments, doc kind of columns.

> Who is we in this conversation?  If it’s the documentation please reference
> existing work.  Text is our preferred type and we are fairly consistent in
> using it to my knowledge.

Even granting the premise, who's to say what an appropriate maximum
length for "products.name" would be?

IMNSHO, both char(N) and varchar(N) are hangovers from punched-card
days.  The number of cases where you can actually specify a limit
that wasn't pulled out of the air can be counted without running out
of fingers.  Moreover, most of those cases can be traced to standards
that were written when punched cards were au courant (postal codes for
example) and hence thought that an arbitrary limit was a good thing.
Time to move on.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2024-07-18 05:28 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-18 05:10 Column data type in doc example may be changed to VARCHAR from TEXT Muhammad Ikram <mmikram@gmail.com>
2024-07-18 05:17 ` David G. Johnston <david.g.johnston@gmail.com>
2024-07-18 05:22   ` Muhammad Ikram <mmikram@gmail.com>
2024-07-18 05:28   ` Tom Lane <tgl@sss.pgh.pa.us>

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