Re: [BUGS] Invalid YAML output from EXPLAIN

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: [BUGS] Invalid YAML output from EXPLAIN
Дата
Msg-id c7eb14d5c80bd09b647e3143e0d7a77d@biglumber.com
обсуждение исходный текст
Ответы Re: [BUGS] Invalid YAML output from EXPLAIN  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Dean Rasheed wrote:
...
> So the current code in escape_yaml() is inadequate for producing valid
> YAML. I think it would have to also consider at least the following
> characters as special "-"  ":"  "["  "]"  "{"  "}"  ","  "\""  "'"
> "|"  "*"  "&". Technically, it would also need to trap empty strings,
> and strings with leading or trailing whitespace.
>
> Making escape_yaml() completely bulletproof with this approach would
> be quite difficult, and (IMO) not worth the effort
...

Doesn't seem like a lot of effort to me. You've already laid out most of 
the exceptions above, although they require a few tweaks.
The rules should be:

Requires quoting only if the first character:&  *  !  |  >  '  "  %  @  ` #

Same as above, but no quoting if the second character is "safe":-  ?  :

Always requires quoting:":<space>"  "<space>#"  aka  ': '  ' #'

Always requires quoting:,  [  ]  {  }

Always require quoting:(leading space) (trailing space) (empty string)

See:
http://yaml.org/spec/1.2/spec.html section 5.3 and 7.3.3


- -- 
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201006070943
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkwM+wAACgkQvJuQZxSWSsgWZACcCgb0rDvA6ZVhHId/q568gBGo
sjgAoLY7HbkI7sRpO45vi0jSRJ2Fiytk
=v7T/
-----END PGP SIGNATURE-----




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Add current WAL end (as seen by walsender, ie, GetWriteRecPtr()
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] Invalid YAML output from EXPLAIN