Re: Postgre RAISE NOTICE and PHP - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Postgre RAISE NOTICE and PHP
Date
Msg-id dcc563d10908181345k3bc840a9w1dd8ccb4c79d74b8@mail.gmail.com
Whole thread Raw
In response to Postgre RAISE NOTICE and PHP  (Andre Lopes <lopes80andre@gmail.com>)
Responses Re: Postgre RAISE NOTICE and PHP  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-general
On Tue, Aug 18, 2009 at 10:57 AM, Andre Lopes<lopes80andre@gmail.com> wrote:
> Hi,
>
> I'm developing a function with some checks, for example... to check if the
> e-mail is valid or not.
>
> If the e-mail is not valid I put a line with RAISE NOTICE 'E-mail not
> valid'.
>
> I need to know if it is possible to show this RAISE NOTICE when I run this
> function from PHP.

http://www.php.net/manual/en/function.pg-last-notice.php

example plpgsql function:
create or replace function tester() returns int language plpgsql as $$
BEGIN
raise notice 'whoops';
return 1;
END
$$;

example php:
<?php
$conn = pg_connect("dbname=smarlowe");
$res = pg_query("select tester()");
print pg_last_notice($conn);
print "\n";
?>

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Any justification for sequence table vs. native sequences?
Next
From: Andre Lopes
Date:
Subject: Access Control System - Design