Re: have you feel anything when you read this ? - Mailing list pgsql-sql

From Markus Schaber
Subject Re: have you feel anything when you read this ?
Date
Msg-id 44350DDE.8000201@logix-tt.com
Whole thread Raw
In response to Re: have you feel anything when you read this ?  ("Eugene E." <sad@bankir.ru>)
Responses Re: have you feel anything when you read this ?
List pgsql-sql
Hi, Eugene,

Eugene E. wrote:

>> Okay, now pass that to strcmp or a %s format. AFAIK, the
>> "textual-form" of
>> values is meant to be a c-string. "ab\0cd\0" is not a c-string containing
>> ab\0cd, it's a c-string containing ab.
> WHY strcmp ?! do you really think the user is a fool ?
> if the user declared something "binary", he obviously knows what he has
> done.

But when the user requests the canonical _text_ representation of a byte
area data type, why do you consider him declaring it "binary"?

> WHY c-string ? the user only wants to get PGresult structure.

And he does request the _text_ represenation of the datatypes in this
structure.

> Since this structure provides a length of each value, you have no need
> in c-string. Why do think the user needs it ?

A user that does not have a need in C-Strings can fetch the binary
representation, getting higher efficency for all datatypes.

> "textual-form" is just a name of actually existent convertion rule.
> i am not trying to find out a philosophy here.

There is no philosophy but orthogonality.

There's a textual and a binary form of datatypes. For varchar, byta,
int4, float, PostGIS geometries etc...

>> I think I don't exactly agree with this description, but I'm unclear
>> exactly what you're saying.  Are you saying that textual-form is the
>> useful representation, or are you saying that textual-form is the
>> representation and it is useful?
> the actual representasion of most types is pretty useful.

The text representation is pretty useful for human readers for _most_
datatypes, the binary representation is much easier to parse for programs.

So use the binary representation for everything if you don't want to
display the data to the user directly.

One could speculate that the textual representation is just a little
help for "generic" tools like pg_dump, pgadmin or psql that display data
to the user without having any knowledge of the specific datatypes (and
without the possibility to have such knowledge).

Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org


pgsql-sql by date:

Previous
From: Michael Burke
Date:
Subject: Re: SELECT composite type
Next
From: "Eugene E."
Date:
Subject: Re: have you feel anything when you read this ?