pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
bit-strings with white space
4+ messages / 4 participants
[nested] [flat]

* bit-strings with white space
@ 2018-04-18 09:55 PG Doc comments form <noreply@postgresql.org>
  2018-04-22 17:18 ` Re: bit-strings with white space Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: PG Doc comments form @ 2018-04-18 09:55 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: pauleg.carter@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.6/static/sql-syntax-lexical.html
Description:

Postgresql 9.6, section 4.1.2.5 says that bit-strings can spill over
multiple lines, same as regular string constants. I tried SELECTing such and
found that they may only contain characters '0' and '1'.


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

* Re: bit-strings with white space
  2018-04-18 09:55 bit-strings with white space PG Doc comments form <noreply@postgresql.org>
@ 2018-04-22 17:18 ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-04-23 03:50   ` Re: bit-strings with white space Jim Nasby <jim@nasby.net>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2018-04-22 17:18 UTC (permalink / raw)
  To: pauleg.carter@gmail.com; +Cc: pgsql-docs@lists.postgresql.org

=?utf-8?q?PG_Doc_comments_form?= <noreply@postgresql.org> writes:
> Postgresql 9.6, section 4.1.2.5 says that bit-strings can spill over
> multiple lines, same as regular string constants. I tried SELECTing such and
> found that they may only contain characters '0' and '1'.

As indeed the text says.  What the continuation mention is talking
about is this syntax:

regression=# select b'10001'
     '00100';
  ?column?  
------------
 1000100100
(1 row)

which works like

regression=# select 'foo'
   'bar';
 ?column? 
----------
 foobar
(1 row)

Perhaps there's something we could change to make this clearer,
but I'm not sure what.

			regards, tom lane




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

* Re: bit-strings with white space
  2018-04-18 09:55 bit-strings with white space PG Doc comments form <noreply@postgresql.org>
  2018-04-22 17:18 ` Re: bit-strings with white space Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-04-23 03:50   ` Jim Nasby <jim@nasby.net>
  2018-04-23 04:07     ` Re: bit-strings with white space David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Jim Nasby @ 2018-04-23 03:50 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; pauleg.carter@gmail.com; +Cc: pgsql-docs@lists.postgresql.org

On 4/22/18 12:18 PM, Tom Lane wrote:
> regression=# select 'foo'
>     'bar';
>   ?column?
> ----------
>   foobar
> (1 row)
> 
> Perhaps there's something we could change to make this clearer,
> but I'm not sure what.

I had no idea you could do that. While there's probably some wordy 
description that could explain this, I think an example is probably the 
best bet. Are there any other data types that work like this?
-- 
Jim C. Nasby, Data Architect                       jim@nasby.net
512.569.9461 (cell)                         http://jim.nasby.net




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

* Re: bit-strings with white space
  2018-04-18 09:55 bit-strings with white space PG Doc comments form <noreply@postgresql.org>
  2018-04-22 17:18 ` Re: bit-strings with white space Tom Lane <tgl@sss.pgh.pa.us>
  2018-04-23 03:50   ` Re: bit-strings with white space Jim Nasby <jim@nasby.net>
@ 2018-04-23 04:07     ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: David G. Johnston @ 2018-04-23 04:07 UTC (permalink / raw)
  To: Jim Nasby <jim@nasby.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pauleg.carter@gmail.com <pauleg.carter@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

On Sunday, April 22, 2018, Jim Nasby <jim@nasby.net> wrote:

> On 4/22/18 12:18 PM, Tom Lane wrote:
>
>> regression=# select 'foo'
>>     'bar';
>>   ?column?
>> ----------
>>   foobar
>> (1 row)
>>
>> Perhaps there's something we could change to make this clearer,
>> but I'm not sure what.
>>
>
> I had no idea you could do that. While there's probably some wordy
> description that could explain this, I think an example is probably the
> best bet. Are there any other data types that work like this?
>
>
This structural "normalization" gets applied before types get involved.
Two literals only separated by a newline are concatenated together.  Any
type name prefix, E or b prefix, :: cast, or cast() application then gets
applied to the combined literal.

The sql syntax section on this could maybe use another example or two but
does communicate the behavior reasonably well.

https://www.postgresql.org/docs/10/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS

David J.

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


end of thread, other threads:[~2018-04-23 04:07 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 09:55 bit-strings with white space PG Doc comments form <noreply@postgresql.org>
2018-04-22 17:18 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-04-23 03:50   ` Jim Nasby <jim@nasby.net>
2018-04-23 04:07     ` David G. Johnston <david.g.johnston@gmail.com>

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