[SQL] My Trigger is not working :(

2011-09-09 Thread Waqar Azeem
I think i missed some basics ... ERROR: column "ad_table_id" does not exist Where: PL/pgSQL function "oms_changelog" line 21 at assignment -- trigger definition -- CREATE OR REPLACE FUNCTION oms_changelog() RETURNS trigger AS $BODY$ DECLAR

Re: [SQL] My Trigger is not working :(

2011-09-09 Thread pasman pasmaƄski
DECLARE section not contain variable AD_TABLE_ID 2011/9/9, Waqar Azeem : > I think i missed some basics ... > > > ERROR: column "ad_table_id" does not exist > Where: PL/pgSQL function "oms_changelog" line 21 at assignment > > -- > trigger definition >

Re: [SQL] My Trigger is not working :(

2011-09-09 Thread Waqar Azeem
Thanks... After putting some code here ... starts getting this error ... SQL statement "INSERT INTO ad_changelog( ad_changelog_id, ad_session_id, ad_table_id, ad_column_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, record_id, oldvalue, newvalue, undo, redo, iscusto

[SQL] Re: how can I get the length of columns of a table by system tables/views

2011-09-09 Thread shuaixf
SELECT a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod) FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT pg_class.oid FROM pg_class INNER JOIN pg_namespace ON (pg_class.relnamespace = pg_namespace.oid AND low

Re: [SQL] Re: how can I get the length of columns of a table by system tables/views

2011-09-09 Thread msi77
Why not to use information schema: select column_name, character_maximum_length from information_schema.columns where table_name ='table name' 09.09.2011, 16:53, "shuaixf" : > SELECT a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod) > FROM pg_catalog.pg_attribute a > WHERE a.attrelid =

[SQL] Dynamic sql

2011-09-09 Thread Gabriel Filipiak
Hi, this is my first on this list. I want to know the basics of dynamic sql especially in PostgreSQL. I was googling for a while but have no luck for getting a good described examples. Maybe someone here could give me some links to the materials from which you where studying this subject. Ok so t