printing variable values in pl/pgsql functions

Started by Harpreet Dhaliwalalmost 19 years ago4 messagesgeneral
Jump to latest
#1Harpreet Dhaliwal
harpreet.dhaliwal01@gmail.com

Hi,

I have a pl/pgsql in which i have to print various variable values during
the execution of the function to see
what values are getting populated inside those variables with due course of
time.

PRINT <variable name>
doesn't work.

Can anyone tell me how to print these values??

Thanks,
~Harpreet

#2Harpreet Dhaliwal
harpreet.dhaliwal01@gmail.com
In reply to: Harpreet Dhaliwal (#1)

Hi,

I have a pl/pgsql in which i have to print various variable values during
the execution of the function to see
what values are getting populated inside those variables with due course of
time.

PRINT <variable name>
doesn't work.

Can anyone tell me how to print these values??

Thanks,
~Harpreet

#3Jasbinder Bali
jsbali@gmail.com
In reply to: Harpreet Dhaliwal (#2)
Re: printing variable values in pl/pgsql functions

you can use
RAISE NOTICE 'i want to print % and %', var1,var2;

then run your function and click the MESSAGE tab at the bottom of your query
analyzer screen and you'll see sometime like

NOTICE: i want to print <value of var 1> and <value of var2

you can use any number of RAISE NOTICE statements as you want and they will
be printed in order under messages.

I hope this helps
~Jas

Show quoted text

On 5/8/07, Harpreet Dhaliwal <harpreet.dhaliwal01@gmail.com> wrote:

Hi,

I have a pl/pgsql in which i have to print various variable values during
the execution of the function to see
what values are getting populated inside those variables with due course
of time.

PRINT <variable name>
doesn't work.

Can anyone tell me how to print these values??

Thanks,
~Harpreet

#4Martin Gainty
mgainty@hotmail.com
In reply to: Harpreet Dhaliwal (#1)
Re: printing variable values in pl/pgsql functions

\echo will print contents of whatever follows
http://www.postgresql.org/docs/8.1/static/app-psql.html

M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.

----- Original Message -----
From: Harpreet Dhaliwal
To: pgsql-general@postgresql.org
Sent: Tuesday, May 08, 2007 8:40 PM
Subject: [GENERAL] printing variable values in pl/pgsql functions

Hi,

I have a pl/pgsql in which i have to print various variable values during the execution of the function to see
what values are getting populated inside those variables with due course of time.

PRINT <variable name>
doesn't work.

Can anyone tell me how to print these values??

Thanks,
~Harpreet