GetSchema Triggers amd arguments

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
marty
Posts: 4
Joined: Mon 18 Apr 2011 13:41

GetSchema Triggers amd arguments

Post by marty » Wed 18 May 2011 06:51

I'm using PgSqlConnection.GetSchema to look at the triggers collection.
It returns name, schema, definer, language, argumentcount,oid etc...
What I need is the table the trigger refers to.

I presume under the covers, the provider is selecting from pg_trigger, like this example: http://www.alberton.info/postgresql_meta_info.html
In which case it's a simple join to pg_class on pg_trigger.tgrelid = pg_class.oid to read the relname.

For the time being I'm using a form of the select trigger metadata statement from that webpage directly, which tells me details of before/after insert/delete/update and event.

It would be nice to be able to call GetSchema triggers with that extra information.

There's also a GetSchema arguments collection. This is always empty for me. When I use the example function from the page http://www.alberton.info/postgresql_meta_info.html I can see the function arguments.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 18 May 2011 15:45

1. Thank you for your suggestions about GetSchema("Triggers", ...) improvement. We will notify you about the results of our investigation.

2.
marty wrote:There's also a GetSchema arguments collection. This is always empty for me. When I use the example function from the page http://www.alberton.info/postgresql_meta_info.html I can see the function arguments.
Have you tried GetSchema("Arguments", ...) for functions or trigger functions?
The "Arguments" collection has these restrictions in the following order:
0 - Schema name
1 - Function name
2 - User name
3 - Type
4 - Function OID (for overload functions)

I have tried the GetSchema("Arguments", new string[] {"schema_name", "function_name") scenario. It works in my environment.

marty
Posts: 4
Joined: Mon 18 Apr 2011 13:41

Post by marty » Thu 19 May 2011 06:11

Shalex wrote:1. Thank you for your suggestions about GetSchema("Triggers", ...) improvement. We will notify you about the results of our investigation.
Cool.
Shalex wrote: 2. Have you tried GetSchema("Arguments", ...) for functions or trigger functions?
I have tried the GetSchema("Arguments", new string[] {"schema_name", "function_name") scenario. It works in my environment.
Ah, now I see how it works. I assumed I could load the arguments for all functions by not passing the restriction. Thanks for the clarification.

Post Reply