pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
about  value  storage
2+ messages / 2 participants
[nested] [flat]

* about  value  storage
@ 2011-09-06 02:43 lsliang <lsliang@pconline.com.cn>
  2011-09-06 15:52 ` Re: about value storage Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: lsliang @ 2011-09-06 02:43 UTC (permalink / raw)
  To: pgsql-docs

http://www.postgresql.org/docs/9.0/interactive/typeconv-query.html 

example shows: 

CREATE TABLE vv (v character(20));
INSERT INTO vv SELECT 'abc' || 'def';
SELECT v, length(v) FROM vv;

          v           | length
----------------------+--------
 abcdef               |     20
(1 row)


but  my test show not like this :

               ^
lsl=# select version();
                                                      version                                                      
-------------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.0.1 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit
(1 row)

lsl=# CREATE TABLE vv (v character(20));
INSERT INTO vv SELECT 'abc' || 'def';
SELECT v, length(v) FROM vv;
CREATE TABLE
lsl=# INSERT INTO vv SELECT 'abc' || 'def';
INSERT 0 1
lsl=# SELECT v, length(v) FROM vv;
          v           | length 
----------------------+--------
 abcdef               |      6
(1 row)


why ??   anyone  help me ? 

or  it is a  doc mistake ? 

thank you! 

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

* Re: about value storage
  2011-09-06 02:43 about  value  storage lsliang <lsliang@pconline.com.cn>
@ 2011-09-06 15:52 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2011-09-06 15:52 UTC (permalink / raw)
  To: lsliang <lsliang@pconline.com.cn>; +Cc: pgsql-docs

"lsliang" <lsliang@pconline.com.cn> writes:
> http://www.postgresql.org/docs/9.0/interactive/typeconv-query.html 
> example shows: 

> CREATE TABLE vv (v character(20));
> INSERT INTO vv SELECT 'abc' || 'def';
> SELECT v, length(v) FROM vv;

>           v           | length
> ----------------------+--------
>  abcdef               |     20
> (1 row)

> but  my test show not like this :

Hmm, looks like that example was overlooked when we changed the behavior
years ago:
http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=f27976c85b1fb9002727cce65b...

Given the context, we should change it to use octet_length().
Will fix, thanks.

			regards, tom lane



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


end of thread, other threads:[~2011-09-06 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-09-06 02:43 about  value  storage lsliang <lsliang@pconline.com.cn>
2011-09-06 15:52 ` Re: about value storage 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