Re: Four questions

From: greg(at)turnstep(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Four questions
Date: 2003-02-19 15:00:57
Message-ID: b7420cbf1047e6c7888063b4882d7c02@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> 1. how can i get count of result's rows where i declare cursor ??

Nothing in DECLARE will tell you this: you will have to do a
SELECT COUNT(*) using the same WHERE clause as the DECLARE to figure
this out. You can always set aside a set amount of memory and only FETCH
that many rows each time of course:

FETCH 23 FROM mycursor;

> 2. I sometime select look like for example select 123 as "Foo 3" , 456 as
> "Foo 4 ... ", and writing where is fanny.. in select should be somthing
> like [] what == name of col. select would look : "select 232 as "QWE RTYU"
> where [1] LIKE 'QWE%'; like in C or C++ or in any other lang.

You can use aliases in the WHERE clause, but you must be careful about it.

Not sure what you are asking here, maybe you could ask again with a
different example?

> 3. Good thing will be to have somthing like suid in functions. When I do
> select some_func ('arg1', 2 ,3 ) ; function should read table, and all
> object like owner of this function.

Functions are run with the same privileges as the user that calls it by default.
You can change this by adding "SECURITY DEFINER" when creating the function:

http://www.gtsm.com:81/cgi/psearch?page=sql-createfunction.html;q=security;j=on;c=0;h=1

4. Is possible to bring pg_hba.conf to db, in to pg_* tables ??

I'm sure someone has done this, but I don't have a pointer handy.

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200302190932
-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE+U5rrvJuQZxSWSsgRAs5AAJ4vRL4NCOBDvaGbj9n/gzhoml8hoQCguc8N
Nua9LrCzWXwEkDXDcuPsoAw=
=YMny
-----END PGP SIGNATURE-----

In response to

  • at 2003-02-19 08:05:10 from owner

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marcus Claesson 2003-02-19 15:05:22 Re: How do I get the database connections to close down?
Previous Message Tom Lane 2003-02-19 15:00:29 Re: postgres error reporting