Search Postgresql Archives

Re: Ascii Elephant for text based protocols - Final

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

On 05/16/2016 10:50 PM, Michael Paquier wrote:
On Tue, May 17, 2016 at 5:13 AM, Karsten Hilbert
<Karsten.Hilbert@xxxxxxx> wrote:
         select pg_logo();

seems like a good idea to me :-)

If you propose a patch with a function that returns a setof text, I am
sure it would get some attention. Though I think that you should
remove the mention of the 20th anniversary.


Thank you for the feedbacks.

Good idea. I will write a function. The most basic would be:

CREATE OR REPLACE FUNCTION pg_logo()
RETURNS SETOF TEXT
AS $$
BEGIN
  RETURN QUERY SELECT '  ____  ______  ___  '::TEXT;
  RETURN QUERY SELECT ' /    )/      \/   \ '::TEXT;
  RETURN QUERY SELECT '(     / __    _\    )'::TEXT;
  RETURN QUERY SELECT ' \    (/ o)  ( o)   )'::TEXT;
  RETURN QUERY SELECT '  \_  (_  )   \ ) _/ '::TEXT;
  RETURN QUERY SELECT '    \  /\_/    \)/   '::TEXT;
  RETURN QUERY SELECT '     \/ <//|  |\\>   '::TEXT;
  RETURN QUERY SELECT '          _|  |      '::TEXT;
  RETURN QUERY SELECT '          \|_/       '::TEXT;
  RETURN;
END;
$$ LANGUAGE plpgsql;

charles@charles.[local]=# select pg_logo();
        pg_logo
-----------------------
   ____  ______  ___
  /    )/      \/   \
 (     / __    _\    )
  \    (/ o)  ( o)   )
   \_  (_  )   \ ) _/
     \  /\_/    \)/
      \/ <//|  |\\>
           _|  |
           \|_/
(9 rows)

But I'd like to add arguments so that it is possible to add a frame and a text as TEXT[]. Additional arguments for the text would be the position (bottom or right) and the alignments (top, bottom, left, right, center). All arguments should have default values so that calling the function without arguments delivers the logo as in the above basic function.

A question to the naming. I find pg_logo() also a good name, but is the prefix pg_* not reserved for system functions? Of course I could use the name I want, but was wondering if there is a policy or a best practice in this area.

And what schema would be appropriate? I could also create the function without defining a schema and let users decide where they want to put it.

An alternative for the name could be logo(), in analogy to version().

Bye
Charles


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux