Re: Receiving data in binary format how is it encoded? - Mailing list pgsql-hackers

From Francisco Figueiredo Jr.
Subject Re: Receiving data in binary format how is it encoded?
Date
Msg-id 3F088890.1000604@yahoo.com.br
Whole thread Raw
In response to Re: Receiving data in binary format how is it encoded?  (Carlos Guzman Alvarez <carlosga@telefonica.net>)
List pgsql-hackers
Carlos Guzman Alvarez wrote:

> Hello:
> 

Hello

>> Yeah, while waiting for the response, I added support for the int4 
>> datatype. It is really encoded as a 4 bytes value.
> 
> 
> :)
> 
>> Uhmmm, where did you take the 2000,1,1 as base from?
>> If the date is before 2000, days will have a negative value, so date 
>> is calculated correctly backwards?
> 
> 
> In the little tests i do, yes.

Good. I think I found where you get 200,1,1 from:
In datetime.c in the AST dir, there is a line which says:
Assert(POSTGRES_EPOCH_JDATE == date2j(2000, 1, 1));


> 
> 
>> Thanks Carlos. do you know in what file are these values produced?
> 
> 
> Not sure but i'm reviewing files in directory:
> 
> src\backend\utils\adt
> 
> This is what seems to be sent for numeric datatype i'm going to test it 
> now :D:
> 
>     pq_sendint(&buf, x.ndigits, sizeof(int16));
>     pq_sendint(&buf, x.weight, sizeof(int16));
>     pq_sendint(&buf, x.sign, sizeof(int16));
>     pq_sendint(&buf, x.dscale, sizeof(int16));
>     for (i = 0; i < x.ndigits; i++)
>         pq_sendint(&buf, x.digits[i], sizeof(NumericDigit));
> 
> 

Thanks. I will have a look in the types in the AST dir.


-- 
Regards,

Francisco Figueiredo Jr.

------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi



pgsql-hackers by date:

Previous
From: ivan
Date:
Subject: aliases
Next
From: Alvaro Herrera
Date:
Subject: Re: aliases