Re: Beginner - Help for pgsql 8.0.3 win32 platform - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Beginner - Help for pgsql 8.0.3 win32 platform
Date
Msg-id 20050820154655.GA61044@winnie.fuhr.org
Whole thread Raw
In response to Beginner - Help for pgsql 8.0.3 win32 platform  (Nugroho Laison <nugon19@yahoo.com>)
List pgsql-general
On Fri, Aug 19, 2005 at 03:01:38PM -0700, Nugroho Laison wrote:
> = how to get raise notice messages at client database
> API such as ODBC, ADO, DAO, RDO or client programming
> such as PHP, JSP, C/C++, Java?

You'll have to consult the interface's documentation.  For example,
for C see the "libpq - C Library" chapter in the PostgreSQL
documentation:

http://www.postgresql.org/docs/8.0/static/libpq.html
http://www.postgresql.org/docs/8.0/static/libpq-notice-processing.html

> = how to get number of affected rows by last sql
> statement/operation (using GET DIAGNOSTICS statement)?

For server-side PL/pgSQL programming see "Obtaining the Result
Status" in the PL/pgSQL documentation:

http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS

For client-side C code, see "Retrieving Query Result Information"
and "Retrieving Result Information for Other Commands" in the libpq
documentation:

http://www.postgresql.org/docs/8.0/static/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO
http://www.postgresql.org/docs/8.0/static/libpq-exec.html#LIBPQ-EXEC-NONSELECT

For other interfaces, see the relevant documentation.

> = how to use PERFORM statement?

See "Executing an Expression or Query With No Result" in the PL/pgSQL
documentation:

http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-PERFORM

> = how to use EXECUTE statement?

EXECUTE means different things depending on whether you're using
PL/pgSQL or SQL.  See the documentation for examples:

http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
http://www.postgresql.org/docs/8.0/static/sql-execute.html

> = is it true that must state/write
> <EXCEPTION_CONDITION_NAME> (e.g. division_by_zero ,
> error_in_assignment, etc) where we using EXCEPTION?
> can we use custom logical error condition (e.g.
> (my_Var = 0), (rec_count > 0), (gender = 'M'),
> (sqlstate <> 0 --> error system variable), etc)

See "Trapping Errors" in the PL/pgSQL documentation for the allowed
usage:

http://www.postgresql.org/docs/8.0/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

> = is there any virtual object that we can access to
> examine new inserted or old deleted record in  trigger
> for statement (such as old and new in trigger for
> row)?

See "Trigger Procedures" in the PL/pgSQL documentation or the
documentation for whatever server-side language you're using.

http://www.postgresql.org/docs/8.0/static/plpgsql-trigger.html

> = can we create disconnected cursor?
> (e.g.
>
> declare
>     v_cursor1 refcursor;
>     v_cursor2 refcursor;
>
> ...
> ...
>  open v_cursor1;
>  v_cursor2 := v_cursor1;
>  close v_cursor1;
>  fetch v_cursor2;

See "Cursors" in the PL/pgSQL documentation for the allowed usage:

http://www.postgresql.org/docs/8.0/static/plpgsql-cursors.html

If the documentation doesn't answer your questions, then please
post specific examples of what you're trying to do and describe the
difficulties you're having.

--
Michael Fuhr

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Postgresql Function Language question
Next
From: CSN
Date:
Subject: selecting rows older than X, ensuring index is used