Re: [GENERAL] User privilege information.

2007-02-15 Thread tonylaq
On Feb 15, 6:32 am, [EMAIL PROTECTED] ("Alexi Gen") wrote:
> Hello,
>
> How do I find out the privileges of a particular user?
> (names and ids of the objects and their permissions the user has access to)
> If there a single table/view that can give this information - please point
> me to it.
> Otherwise - give the names of the tables/views that contain this
> information.
>
> Cheers
> sqlcatz
>
> _
> Catch all the cricketing action right here. Live score, match reports,
> photos et al.http://content.msn.co.in/Sports/Cricket/Default.aspx
>
> ---(end of broadcast)---
> TIP 1: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to [EMAIL PROTECTED] so that your
>message can get through to the mailing list cleanly

Try \z tableName


anthony


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


Re: [GENERAL] Setting up functions in psql.

2007-02-18 Thread tonylaq
On Feb 16, 12:06 am, [EMAIL PROTECTED] (Paul Lambert)
wrote:
> Tom Lane wrote:
> > Paul Lambert <[EMAIL PROTECTED]> writes:
> >> What I am confused about is: Why does the creation of a function fail if
> >> a table it uses does not exist when the function itself is creating the
> >> table further up to where it references it?
>
> > Because the function isn't actually being *executed*, only
> > syntax-checked.
>
> > The syntax precheck isn't completely reliable, for this reason among
> > others, so you can turn it off via check_function_bodies = off.
>
> > However, I'm not sure but what the function would fail anyway at runtime
> > for the same reason.  I think in a SQL function, it all gets parsed
> > before any is executed.  (This could probably get fixed, if we thought
> > it was worth the trouble.)
>
> >> Secondly, and here's the obviously easy one that I'm having a mental
> >> blank trying to figure out... How would I execute a function (such as
> >> the above) from psql?
>
> > select "fnLoadAppraisals"();
>
> >regards, tom lane
>
> > ---(end of broadcast)---
> > TIP 6: explain analyze is your friend
>
> AutoDRS=# select "fnLoadAppraisals"();
> ERROR:  relation with OID 18072 does not exist
> CONTEXT:  SQL function "fnLoadAppraisals" statement 5
>
> 18072 is the OID of table appraisals_temp_load
>
> If I run the code within the function by itself, i.e. copy and paste the
> 6 lines of SQL int psql it runs fine... What precisely is this error
> telling me? It's not entirely clear to me.
>
> --
> Paul Lambert
> Database Administrator
> AutoLedgers
>
> ---(end of broadcast)---
> TIP 3: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faq

Hi Paul,
Already have that problem.


If I remember correctly, when you first call a function, it's compiled
so the server know exactly what/where find tables.

The function know what is the OID needed.
If you drop/create the same table name, the OID change and then the
function is not able to work anymore.

So you have 2 choices :
1- Drop/recreate the function each time. (So the function will be
recompiled each time) ...
2- Put EXECUTE in your function. ( EXECUTE will be compiled at runtime
& the function will always know what is the good OID)

anthony


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match