Re: protocol change in 7.4

Lists: pgsql-hackers
From: Neil Conway <neilc(at)samurai(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: protocol change in 7.4
Date: 2002-11-05 00:22:54
Message-ID: 87wuns3lwh.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

There has been some previous discussion of changing the FE/BE protocol
in 7.4, in order to fix several problems. I think this is worth doing:
if we can resolve all these issues in a single release, it will lessen
the upgrade difficulties for users.

I'm aware of the following problems that need a protocol change to fix
them:

(1) Add an optional textual message to NOTIFY

(2) Remove the hard-coded limits on database and user names
(SM_USER, SM_DATABASE), replace them with variable-length
fields.

(3) Remove some legacy elements in the startup packet
('unused' can go -- perhaps 'tty' as well). I think the
'length' field of the password packet is also not used,
but I'll need to double-check that.

(4) Fix the COPY protocol (Tom?)

(5) Fix the Fastpath protocol (Tom?)

(6) Protocol-level support for prepared queries, in order to
bypass the parser (and maybe be more compatible with the
implementation of prepared queries in other databases).

(7) Include the current transaction status, since it's
difficult for the client app to determine it for certain
(Tom/Bruce?)

If I've missed anything or if there is something you think we should
add, please let me know.

I can implement (1), (2), (3), and possibly (7), if someone can tell
me exactly what is required (my memory of the discussion relating to
this is fuzzy). The rest is up for grabs.

Finally, how should we manage the transition? I wasn't around for the
earlier protocol changes, so I'd appreciate any input on steps we can
take to improve backward-compatibility.

Cheers,

Neil

--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC


From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-05 00:32:56
Message-ID: 3DC711B8.3030509@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Neil Conway wrote:
> There has been some previous discussion of changing the FE/BE protocol
> in 7.4, in order to fix several problems. I think this is worth doing:
> if we can resolve all these issues in a single release, it will lessen
> the upgrade difficulties for users.

<snip>

>
> If I've missed anything or if there is something you think we should
> add, please let me know.

Is there any thought about changing the protocol to support
two-phase commit? Not that 2PC and distributed transactions
would be implemented in 7.4, but to prevent another protocol
change in the future?

Mike Mascari
mascarm(at)mascari(dot)com


From: Neil Conway <neilc(at)samurai(dot)com>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-05 00:42:55
Message-ID: 87r8e03kz4.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Mike Mascari <mascarm(at)mascari(dot)com> writes:
> Is there any thought about changing the protocol to support
> two-phase commit? Not that 2PC and distributed transactions would be
> implemented in 7.4, but to prevent another protocol change in the
> future?

My understanding is that 2PC is one way to implement multi-master
replication. If that's what you're referring to, then I'm not sure I
see the point: the multi-master replication project (pgreplication)
doesn't use 2PC, due to apparent scalability problems (not to mention
that it also uses a separate channel for communications between
backends on different nodes).

Cheers,

Neil

--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC


From: Darren Johnson <darren(at)up(dot)hrcoxmail(dot)com>
To: Satoshi Nagayasu <pgsql(at)snaga(dot)org>
Cc: Mike Mascari <mascarm(at)mascari(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: protocol change in 7.4
Date: 2002-11-05 00:55:08
Message-ID: 3DC716EC.7040003@up.hrcoxmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

>
>
>
>I'm now implementing 2PC replication and distributed transaction. My 2PC
>needs some supports in startup packet to establish a replication session
>or a recovery session.
>
>BTW, my 2PC replication is working, and I'm implementing 2PC recovery now.
>
I would like to here more about your implementation. Do you have some
documentation that I
could read?

If not, perhaps (if you have the time) you could put together a post
describing your work. Like
Is it an internal or external solution. Are you sending SQL or tuples
in your update messages.
How are you handling failure detection? Is this partial or full
replication?

Please forgive me for asking so many questions, but I'm rather intrigued
by database
replication.

Darren

>
>


From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-05 01:10:29
Message-ID: 3DC71A85.9000708@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Neil Conway wrote:
> Mike Mascari <mascarm(at)mascari(dot)com> writes:
>
>>Is there any thought about changing the protocol to support
>>two-phase commit? Not that 2PC and distributed transactions would be
>>implemented in 7.4, but to prevent another protocol change in the
>>future?
>
> My understanding is that 2PC is one way to implement multi-master
> replication. If that's what you're referring to, then I'm not sure I
> see the point: the multi-master replication project (pgreplication)
> doesn't use 2PC, due to apparent scalability problems (not to mention
> that it also uses a separate channel for communications between
> backends on different nodes).

Actually, I was thinking along the lines of a true CREATE
DATABASE LINK implementation, where multiple databases could
participate in a distributed transaction. That would require the
backend in which the main query is executing to act as the
"coordinator" and each of the other participating databases to
act as "cohorts". And would require a protocol change to support
the PREPARE, COMMIT-VOTE/ABORT-VOTE reply, and an ACK message
following the completion of the distributed COMMIT or ABORT.

Mike Mascari
mascarm(at)mascari(dot)com


From: Satoshi Nagayasu <snaga(at)snaga(dot)org>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: protocol change in 7.4
Date: 2002-11-05 01:14:21
Message-ID: 20021105101421.42aa1c02.snaga@snaga.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

Mike Mascari <mascarm(at)mascari(dot)com> wrote:
> Is there any thought about changing the protocol to support
> two-phase commit? Not that 2PC and distributed transactions
> would be implemented in 7.4, but to prevent another protocol
> change in the future?

I'm now implementing 2PC replication and distributed transaction. My 2PC
needs some support in startup packet to establish a replication session
and a recovery session.

BTW, 2PC replication is working, and I'm implementing 2PC recovery now.

--
NAGAYASU Satoshi <snaga(at)snaga(dot)org>


From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-05 01:22:55
Message-ID: 20021105012255.GA7156@wallace.ece.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Nov 04, 2002 at 08:10:29PM -0500, Mike Mascari wrote:

> Actually, I was thinking along the lines of a true CREATE
> DATABASE LINK implementation, where multiple databases could
> participate in a distributed transaction. That would require the
> backend in which the main query is executing to act as the
> "coordinator" and each of the other participating databases to
> act as "cohorts". And would require a protocol change to support
> the PREPARE, COMMIT-VOTE/ABORT-VOTE reply, and an ACK message
> following the completion of the distributed COMMIT or ABORT.

Right, you need TPC in order for pgsql to participate in transactions
that span anything outside the DB proper. A DB link is one example,
or an external transaction manager that coordinates DB and filesystem
updates, for example. Zope could use this, to coordinate the DB with
it's internal object store.

Ross


From: Satoshi Nagayasu <pgsql(at)snaga(dot)org>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: protocol change in 7.4
Date: 2002-11-05 01:33:16
Message-ID: 20021105103316.2f3030fa.pgsql@snaga.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

Mike Mascari <mascarm(at)mascari(dot)com> wrote:
> Is there any thought about changing the protocol to support
> two-phase commit? Not that 2PC and distributed transactions
> would be implemented in 7.4, but to prevent another protocol
> change in the future?

I'm now implementing 2PC replication and distributed transaction. My 2PC
needs some supports in startup packet to establish a replication session
or a recovery session.

BTW, my 2PC replication is working, and I'm implementing 2PC recovery now.

--
NAGAYASU Satoshi <snaga(at)snaga(dot)org>


From: Satoshi Nagayasu <pgsql(at)snaga(dot)org>
To: Darren Johnson <darren(at)up(dot)hrcoxmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: protocol change in 7.4
Date: 2002-11-05 02:38:08
Message-ID: 20021105113808.75035481.pgsql@snaga.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Darren Johnson <darren(at)up(dot)hrcoxmail(dot)com> wrote:
> I would like to here more about your implementation. Do you have some
> documentation that I
> could read?

Documentation is not available, but I have some slides for my presentation.

http://snaga.org/pgsql/20021018_2pc.pdf

Some answers for your questions may be in these slides.

And a current source code is available from:
http://snaga.org/pgsql/pgsql-20021025.tgz

> If not, perhaps (if you have the time) you could put together a post
> describing your work. Like
> Is it an internal or external solution. Are you sending SQL or tuples
> in your update messages.
> How are you handling failure detection? Is this partial or full
> replication?

It is an internal solution. In 2PC, pre-commit and commit are required.
So my implementation has some internal modifications on transaction
handling, log recording and else.

--
NAGAYASU Satoshi <snaga(at)snaga(dot)org>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Satoshi Nagayasu <pgsql(at)snaga(dot)org>
Cc: Darren Johnson <darren(at)up(dot)hrcoxmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: protocol change in 7.4
Date: 2002-11-05 04:46:10
Message-ID: 13298.1036471570@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I don't see why 2PC would require any protocol-level change. I would
think that the API would be something like

BEGIN;
issue some commands ...
PRECOMMIT;
-- if the above does not return an error, then
COMMIT;

In other words, 2PC would require some new commands, but a new command
doesn't affect the protocol layer.

regards, tom lane


From: Grant Finnemore <grantf(at)guruhut(dot)co(dot)za>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-05 05:28:54
Message-ID: 3DC75716.50102@guruhut.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Questions have arisen during discussions about errors relating
to how to support error codes without changing the FE/BE
protocols. (see TODO.detail/error)

Now that the protocol is up for revision, how about supporting
sql state strings, error codes, and other information directly in
the protocol.

Regards,
Grant

Neil Conway wrote:

> There has been some previous discussion of changing the FE/BE protocol
> in 7.4, in order to fix several problems. I think this is worth doing:
> if we can resolve all these issues in a single release, it will lessen
> the upgrade difficulties for users.
>
> I'm aware of the following problems that need a protocol change to fix
> them:
>
> (1) Add an optional textual message to NOTIFY
>
> (2) Remove the hard-coded limits on database and user names
> (SM_USER, SM_DATABASE), replace them with variable-length
> fields.
>
> (3) Remove some legacy elements in the startup packet
> ('unused' can go -- perhaps 'tty' as well). I think the
> 'length' field of the password packet is also not used,
> but I'll need to double-check that.
>
> (4) Fix the COPY protocol (Tom?)
>
> (5) Fix the Fastpath protocol (Tom?)
>
> (6) Protocol-level support for prepared queries, in order to
> bypass the parser (and maybe be more compatible with the
> implementation of prepared queries in other databases).
>
> (7) Include the current transaction status, since it's
> difficult for the client app to determine it for certain
> (Tom/Bruce?)
>
> If I've missed anything or if there is something you think we should
> add, please let me know.
>
> I can implement (1), (2), (3), and possibly (7), if someone can tell
> me exactly what is required (my memory of the discussion relating to
> this is fuzzy). The rest is up for grabs.
>
> Finally, how should we manage the transition? I wasn't around for the
> earlier protocol changes, so I'd appreciate any input on steps we can
> take to improve backward-compatibility.
>
> Cheers,
>
> Neil
>


From: Neil Conway <neilc(at)samurai(dot)com>
To: Grant Finnemore <grantf(at)guruhut(dot)co(dot)za>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-05 05:43:37
Message-ID: 87k7jsfu5y.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Grant Finnemore <grantf(at)guruhut(dot)co(dot)za> writes:
> Now that the protocol is up for revision, how about supporting
> sql state strings, error codes, and other information directly in
> the protocol.

Ah, thanks for pointing that out. Error codes would be another thing
we can ideally support in 7.4, and we'd need a protocol change to do
it properly, AFAICS. IIRC, Peter E. expressed some interest in doing
this...

Cheers,

Neil

--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC


From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-05 08:35:31
Message-ID: 20021105093531.G19182@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Nov 04, 2002 at 07:22:54PM -0500, Neil Conway wrote:
> (1) Add an optional textual message to NOTIFY
>
> (2) Remove the hard-coded limits on database and user names
> (SM_USER, SM_DATABASE), replace them with variable-length
> fields.
>
> (3) Remove some legacy elements in the startup packet
> ('unused' can go -- perhaps 'tty' as well). I think the
> 'length' field of the password packet is also not used,
> but I'll need to double-check that.
>
> (4) Fix the COPY protocol (Tom?)
>
> (5) Fix the Fastpath protocol (Tom?)
>
> (6) Protocol-level support for prepared queries, in order to
> bypass the parser (and maybe be more compatible with the
> implementation of prepared queries in other databases).
>
> (7) Include the current transaction status, since it's
> difficult for the client app to determine it for certain
> (Tom/Bruce?)

(8) Error codes (maybe needn't change protocol)
- without this is PostgreSQL useless in real DB aplication

(9) Think about full dynamic charset encoding (add new encoding on
the fly)

Karel

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz


From: Christof Petig <christof(at)petig-baender(dot)de>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-05 22:54:57
Message-ID: 3DC84C41.7060103@petig-baender.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Neil Conway wrote:
> (6) Protocol-level support for prepared queries, in order to
> bypass the parser (and maybe be more compatible with the
> implementation of prepared queries in other databases).

Let me add
(6b) Protocol level support for query parameters. This would actually
make (6) more powerful and speed up non prepared (but similar)
queries via the query cache (which is already there IIRC).
[I talk about <statement> USING :var ... ]

(n) Platform independant binary representation of parameters and
results (like in CORBA). This can _really_ speed up
communication with compiled programs if you take the time to
implement it. This was previously planned for a future
CORBA fe/be protocol, but this does not seem to come any time
soon.

(n+1) Optional additional Result qualifiers. E.g. dynamic embedded
sql has a
flag to indicate that this column is a key. Previously it was
impossible to set this flag to a meaningful value. Also
the standard has additional statistical information about the
size of the column etc. If it's unclear what I'm talking about
I will look up the exact location in the standard (it's embedded
sql, dynamic sql, get descriptor)

Yours
Christof


From: Christof Petig <christof(at)petig-baender(dot)de>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-06 07:08:45
Message-ID: 3DC8BFFD.5040000@petig-baender.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Christof Petig wrote:
> Neil Conway wrote:
>
>> (6) Protocol-level support for prepared queries, in order to
>> bypass the parser (and maybe be more compatible with the
>> implementation of prepared queries in other databases).
>
>
> Let me add
> (6b) Protocol level support for query parameters. This would actually
> make (6) more powerful and speed up non prepared (but similar)
> queries via the query cache (which is already there IIRC).
> [I talk about <statement> USING :var ... ]
>
> (n) Platform independant binary representation of parameters and
> results (like in CORBA). This can _really_ speed up
> communication with compiled programs if you take the time to
> implement it. This was previously planned for a future
> CORBA fe/be protocol, but this does not seem to come any time
> soon.

After one night's sleep I think that perhaps a CORBA based protocol
might be less work (but I have no idea about a decent authentification
schema, I'd tend to reuse the already authentificated stream). A
corbaized query-only interface might easily cover these issues and be
less work than a full corba backend access. JDBC (I don't know much
about it) might give a reasonable interface design (perhaps combined
with a libpq[++|xx] like interface if there's benefit to it).

> (n+1) Optional additional Result qualifiers. E.g. dynamic embedded
> sql has a
> flag to indicate that this column is a key. Previously it was
> impossible to set this flag to a meaningful value. Also
> the standard has additional statistical information about the
> size of the column etc. If it's unclear what I'm talking about
> I will look up the exact location in the standard (it's embedded
> sql, dynamic sql, get descriptor)

This does not need an implementation soon. But the new protocol should
allow future things like this.

All these proposals are motivated by (future) ecpg [C/C++] needs. So
IMHO the ODBC, JDBC, libpqxx people might be interested in many of these
issues, too. We definitely should make sure to have asked them.

Yours
Christof


From: snpe <snpe(at)snpe(dot)co(dot)yu>
To: Satoshi Nagayasu <snaga(at)snaga(dot)org>, Mike Mascari <mascarm(at)mascari(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: protocol change in 7.4
Date: 2002-11-07 18:40:16
Message-ID: 200211071840.16813.snpe@snpe.co.yu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Is exists patch for 7.4devel ?

regards
Haris Peco
On Tuesday 05 November 2002 01:14 am, Satoshi Nagayasu wrote:
> Hi all,
>
> Mike Mascari <mascarm(at)mascari(dot)com> wrote:
> > Is there any thought about changing the protocol to support
> > two-phase commit? Not that 2PC and distributed transactions
> > would be implemented in 7.4, but to prevent another protocol
> > change in the future?
>
> I'm now implementing 2PC replication and distributed transaction. My 2PC
> needs some support in startup packet to establish a replication session
> and a recovery session.
>
> BTW, 2PC replication is working, and I'm implementing 2PC recovery now.


From: korry <korry(at)starband(dot)net>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-07 20:24:10
Message-ID: 5.1.0.14.0.20021107151457.0437bfa8@pop.starband.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


>There has been some previous discussion of changing the FE/BE protocol
>in 7.4, in order to fix several problems. I think this is worth doing:
>if we can resolve all these issues in a single release, it will lessen
>the upgrade difficulties for users.

Here are a couple of other changes you might consider (maybe these changes
already exist and I just don't know about them):

a) Make much of the metadata sent to the client optional. When I execute
20 fetches against the same cursor, I don't need the same metadata 20
times. For narrow result sets, the metadata can easily double or triple
the number of bytes sent across the net. It looks like the protocol needs
the field count, but everything else seems to be sent for the convenience
of the client application.

b) Send a decoded version of atttypmod - specifically, decode the
precision and scale for numeric types.


From: korry <korry(at)starband(dot)net>
To: snpe <snpe(at)snpe(dot)co(dot)yu>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-07 21:50:00
Message-ID: 5.1.0.14.0.20021107164245.043844c8@pop.starband.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> > b) Send a decoded version of atttypmod - specifically, decode the
> > precision and scale for numeric types.
> >
>I want decode type,length,precision and scale

Type is returned by PQftype(), length is returned by PQfsize(). Precision
and scale are encoded in the return value from PQfmod() and you have to
have a magic decoder ring to understand them. (Magic decoder rings are
available, you just have to read the source code :-)

PQftype() is not easy to use because it returns an OID instead of a name
(or a standardized symbol), but I can't think of anything better to return
to the client. Of course if you really want to make use of PQftype(), you
can preload a client-side cache of type definitions. I seem to remember
seeing a patch a while back that would build the cache and decode precision
and scale too.

PQfsize() is entertaining, but not often what you really want (you really
want the width of the widest value in the column after conversion to some
string format - it seems reasonable to let the client applicatin worry
about that, although maybe that would be a useful client-side libpq function).


From: snpe <snpe(at)snpe(dot)co(dot)yu>
To: korry <korry(at)starband(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-07 22:32:43
Message-ID: 200211072232.43417.snpe@snpe.co.yu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> b) Send a decoded version of atttypmod - specifically, decode the
> precision and scale for numeric types.
>
I want decode type,length,precision and scale

regards
Haris Peco


From: snpe <snpe(at)snpe(dot)co(dot)yu>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-07 22:49:11
Message-ID: 200211072249.11238.snpe@snpe.co.yu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thursday 07 November 2002 09:50 pm, korry wrote:
> > > b) Send a decoded version of atttypmod - specifically, decode the
> > > precision and scale for numeric types.
> >
> >I want decode type,length,precision and scale
>
> Type is returned by PQftype(), length is returned by PQfsize(). Precision
> and scale are encoded in the return value from PQfmod() and you have to
> have a magic decoder ring to understand them. (Magic decoder rings are
> available, you just have to read the source code :-)
>
> PQftype() is not easy to use because it returns an OID instead of a name
> (or a standardized symbol), but I can't think of anything better to return
> to the client. Of course if you really want to make use of PQftype(), you
> can preload a client-side cache of type definitions. I seem to remember
> seeing a patch a while back that would build the cache and decode precision
> and scale too.
>
> PQfsize() is entertaining, but not often what you really want (you really
> want the width of the widest value in the column after conversion to some
> string format - it seems reasonable to let the client applicatin worry
> about that, although maybe that would be a useful client-side libpq
> function).
>
>
I want this in any catalog view

regards
Haris Peco


From: Satoshi Nagayasu <pgsql(at)snaga(dot)org>
To: snpe <snpe(at)snpe(dot)co(dot)yu>
Cc: mascarm(at)mascari(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: protocol change in 7.4
Date: 2002-11-08 00:54:30
Message-ID: 20021108095430.3220d7e8.pgsql@snaga.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> Is exists patch for 7.4devel ?

A full tarball is based on 7.3devel.
There is no patch for 7.4devel.

http://snaga.org/pgsql/

--
NAGAYASU Satoshi <snaga(at)snaga(dot)org>


From: Hannu Krosing <hannu(at)tm(dot)ee>
To: snpe <snpe(at)snpe(dot)co(dot)yu>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-08 09:29:10
Message-ID: 1036747754.1995.37.camel@rh72.home.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

snpe kirjutas R, 08.11.2002 kell 03:49:
> > PQfsize() is entertaining, but not often what you really want (you really
> > want the width of the widest value in the column after conversion to some
> > string format - it seems reasonable to let the client applicatin worry
> > about that, although maybe that would be a useful client-side libpq
> > function).
> >
> >
> I want this in any catalog view

But this will make such a view terribly slow, as ith has to do
max(length(field)) over the whole table for any field displayed

------------
Hannu


From: snpe <snpe(at)snpe(dot)co(dot)yu>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-11-08 11:25:07
Message-ID: 200211081125.07690.snpe@snpe.co.yu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Friday 08 November 2002 09:29 am, Hannu Krosing wrote:
> snpe kirjutas R, 08.11.2002 kell 03:49:
> > > PQfsize() is entertaining, but not often what you really want (you
> > > really want the width of the widest value in the column after
> > > conversion to some string format - it seems reasonable to let the
> > > client applicatin worry about that, although maybe that would be a
> > > useful client-side libpq function).
> >
> > I want this in any catalog view
>
> But this will make such a view terribly slow, as ith has to do
> max(length(field)) over the whole table for any field displayed
>
Why not with this functions ?


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: snpe <snpe(at)snpe(dot)co(dot)yu>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: protocol change in 7.4
Date: 2002-12-10 22:28:22
Message-ID: 200212102228.gBAMSNO14729@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I have added the following TODO item on protocol changes:

> * Wire Protocol Changes
> o Show transaction status in psql
> o Allow binding of query parameters, support for prepared queries
> o Add optional textual message to NOTIFY
> o Remove hard-coded limits on user/db/password names
> o Remove unused elements of startup packet (unused, tty, passlength)
> o Fix COPY/fastpath protocol?
> o Replication support?
> o Error codes
> o Dynamic character set handling
> o Special passing of binary values in platform-neutral format (bytea?)
> o ecpg improvements?
> o Add decoded type, length, precision

---------------------------------------------------------------------------

snpe wrote:
> On Thursday 07 November 2002 09:50 pm, korry wrote:
> > > > b) Send a decoded version of atttypmod - specifically, decode the
> > > > precision and scale for numeric types.
> > >
> > >I want decode type,length,precision and scale
> >
> > Type is returned by PQftype(), length is returned by PQfsize(). Precision
> > and scale are encoded in the return value from PQfmod() and you have to
> > have a magic decoder ring to understand them. (Magic decoder rings are
> > available, you just have to read the source code :-)
> >
> > PQftype() is not easy to use because it returns an OID instead of a name
> > (or a standardized symbol), but I can't think of anything better to return
> > to the client. Of course if you really want to make use of PQftype(), you
> > can preload a client-side cache of type definitions. I seem to remember
> > seeing a patch a while back that would build the cache and decode precision
> > and scale too.
> >
> > PQfsize() is entertaining, but not often what you really want (you really
> > want the width of the widest value in the column after conversion to some
> > string format - it seems reasonable to let the client applicatin worry
> > about that, although maybe that would be a useful client-side libpq
> > function).
> >
> >
> I want this in any catalog view
>
> regards
> Haris Peco
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073