Re: echo work alike in SQL

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: stan <stanb(at)panix(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: echo work alike in SQL
Date: 2019-08-31 16:35:05
Message-ID: CAFj8pRB+DY=nqdRDPsdns47kTq+Qt_t0vG=CavovSyGHZqjMEA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

so 31. 8. 2019 v 17:46 odesílatel stan <stanb(at)panix(dot)com> napsal:

> Just started using the RAISE functionality to help in debugging.
>
> Tried to add it to an SQL script, only to realize it is a PLPGSQL
> extension.
>
> Is there a way to get a string to appear in the output f an SQL script?
>
> Can I do some sort of select?
>

if you run SQL script from psql, then you can use \echo

https://www.postgresql.org/docs/current/app-psql.html

elsewhere you should to use SELECT

or you can use own function

CREATE OR REPLACE FUNCTION public.debug_text(text)
RETURNS text
LANGUAGE plpgsql
AS $function$
BEGIN
RAISE NOTICE '%', $1;
RETURN $1;
END;
$function$

Regards

Pavel

>
> --
> "They that would give up essential liberty for temporary safety deserve
> neither liberty nor safety."
> -- Benjamin Franklin
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-08-31 16:52:59 Re: Question about password character in ECPG's connection string
Previous Message stan 2019-08-31 15:45:09 echo work alike in SQL