pg_input_error_info doc 2 exampled crammed together

Started by jian heover 1 year ago5 messages
#1jian he
jian.universality@gmail.com

hi.

select * from pg_input_error_info('42000000000', 'integer')
select message, detail from pg_input_error_info('1234.567', 'numeric(7,4)')
I found above two examples at [0]https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-VALIDITY crammed together.

<para>
<literal>select * from pg_input_error_info('42000000000',
'integer')</literal>
<returnvalue></returnvalue>
<programlisting>
message | detail | hint
| sql_error_code
------------------------------------------------------+--------+------+----------------
value "42000000000" is out of range for type integer | | | 22003
</programlisting>
</para>
<para>
<literal>select message, detail from
pg_input_error_info('1234.567', 'numeric(7,4)')</literal>
<returnvalue></returnvalue>
<programlisting>
message | detail
------------------------+----------------------------------&zwsp;-------------------------------------------------
numeric field overflow | A field with precision 7, scale 4 must round
to an absolute value less than 10^3.
</programlisting>

after checking the definition of <programlisting>[1]https://tdg.docbook.org/tdg/4.5/programlisting, <screen>[2]https://tdg.docbook.org/tdg/4.5/screen,
maybe here we should use <screen> and also add `(1 row)` information.

or we can simply add a empty new line between
` value "42000000000" is out of range for type integer | | | 22003`
and
`</programlisting>`

[0]: https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-VALIDITY
[1]: https://tdg.docbook.org/tdg/4.5/programlisting
[2]: https://tdg.docbook.org/tdg/4.5/screen

--
I recommend David Deutsch's <<The Beginning of Infinity>>

Jian

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: jian he (#1)
Re: pg_input_error_info doc 2 exampled crammed together

On Sunday, April 28, 2024, jian he <jian.universality@gmail.com> wrote:

after checking the definition of <programlisting>[1], <screen>[2],
maybe here we should use <screen>

Possibly, though I’d be curious to see how consistent we are on this point
elsewhere before making a point of it.

and also add `(1 row)` information.

Doesn’t seem like added value.

or we can simply add a empty new line between
` value "42000000000" is out of range for type integer | | |
22003`
and
`</programlisting>`

My preference would be to limit this section to a single example. The
numeric one, as it provides values for more output columns. I would change
the output format to expanded from default, in order to show all columns
and not overrun the length of a single line.

David J.

#3Michael Paquier
michael@paquier.xyz
In reply to: David G. Johnston (#2)
Re: pg_input_error_info doc 2 exampled crammed together

On Sun, Apr 28, 2024 at 06:45:30PM -0700, David G. Johnston wrote:

My preference would be to limit this section to a single example. The
numeric one, as it provides values for more output columns. I would change
the output format to expanded from default, in order to show all columns
and not overrun the length of a single line.

Agreed that having two examples does not bring much, so this could be
brought to a single one. The first one is enough to show the point of
the function, IMO. It is shorter in width and it shows all the output
columns.
--
Michael

#4David G. Johnston
david.g.johnston@gmail.com
In reply to: Michael Paquier (#3)
Re: pg_input_error_info doc 2 exampled crammed together

On Sunday, April 28, 2024, Michael Paquier <michael@paquier.xyz> wrote:

On Sun, Apr 28, 2024 at 06:45:30PM -0700, David G. Johnston wrote:

My preference would be to limit this section to a single example. The
numeric one, as it provides values for more output columns. I would

change

the output format to expanded from default, in order to show all columns
and not overrun the length of a single line.

Agreed that having two examples does not bring much, so this could be
brought to a single one. The first one is enough to show the point of
the function, IMO. It is shorter in width and it shows all the output
columns.

Agreed. The column names are self-explanatory if you’ve seen errors
before. The values are immaterial. Plus we don’t generally use
psql-specific features in our examples.

David J.

#5Michael Paquier
michael@paquier.xyz
In reply to: David G. Johnston (#4)
Re: pg_input_error_info doc 2 exampled crammed together

On Sun, Apr 28, 2024 at 10:07:49PM -0700, David G. Johnston wrote:

Agreed. The column names are self-explanatory if you’ve seen errors
before. The values are immaterial. Plus we don’t generally use
psql-specific features in our examples.

Okay, I've just cleaned up that a bit with f6ab942f5de0.
--
Michael