9.4. String Functions and Operators page does not document that encode adds line breaks
От | PG Doc comments form |
---|---|
Тема | 9.4. String Functions and Operators page does not document that encode adds line breaks |
Дата | |
Msg-id | 158117862544.1089.17282036641192025921@wrigleys.postgresql.org обсуждение исходный текст |
Ответы |
Re: 9.4. String Functions and Operators page does not document thatencode adds line breaks
Re: 9.4. String Functions and Operators page does not document that encode adds line breaks |
Список | pgsql-docs |
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/12/functions-string.html Description: It took me a long time to discover why a base 64 encoded SHA-512 hash was 89 characters long instead of the expected 88. The documentation does not mention that the encode function inserts newlines after 76 characters. Please make a note of this behavior. By the way, this is a very poor design decision. The function has no knowledge of how the string is going to be used. If it is going to be displayed on an 80-character terminal, then the newline makes sense. If it is going to be written to a PEM-encoded file, then the newline is to be expected. But I'm inserting the result into a VARCHAR(88) column and comparing with base-64 encoded strings from Node.js. There is no reason for the results to be terminal or file friendly. Instead, they should be machine friendly. The decision to add newlines should have been made on display or on creation of the PEM file, where that information becomes available. The workaround of trimming whitespace characters from the encoded string is ugly and unacceptable.
В списке pgsql-docs по дате отправления: