[SQL] Help needed

2005-11-30 Thread NosyMan
Hi everyone, I have some kind of strange problem. I want to build general parametrized trigger for my database. The parameter sent to the trigger contains a column name that trigger should be check. CREATE OR REPLACE FUNCTION F_T_IU__check() RETURNS trigger AS $$ DECLARE

Re: [SQL] How to iterate through arrays?

2005-02-09 Thread NosyMan
I think the problem is not there. I got the following error: 'ERROR: syntax error at or near "[" at character 1234', the line is: RAISE NOTICE '% ...',update_query_params[1]; May be someone give a code sample... Thanks Pe data de Mie 09 Feb 2005 16:16, ati scris: > - use TEXT instead of CHA

[SQL] How to iterate through arrays?

2005-02-09 Thread NosyMan
Hi there, I'm trying to iterate through arrays in PL/PGSQL: DECLARE update_query CHAR; update_query_params CHAR ARRAY[6]; BEGIN update_query_params[1]:='some text';

[SQL] PREPARED STATEMENT

2004-12-11 Thread NosyMan
Hi there, I want to know that is a posibillity to test if a statement is prepared in PL/PgSQL. I have create a function: . PREPARE PSTAT_SAVE_record(INTEGER, INTEGER, DATE, VARCHAR) AS INSERT INTO table VALUES($1, $2, $3, $4); . When I try to execute it second time I got an er

[SQL] PRIMARY KEY and INDEX

2004-09-02 Thread Nosyman
It is necessary to define an index for a primary key column? Let's have an example CREATE TABLE users( id_user INTEGER PRIMARY KEY, user_name VARCHAR(25) ); Does PgSQL automatically create an index for id_user (primary key) or it must be created by hand? Thanks

[SQL] GRANT ON all tables

2004-08-27 Thread Nosyman
Hi there, I need to know how can I give privileges to all the tables in a database. For example, I have one database named "test" .This database contains about 30 tables. I want to grant SELECT and DELETE privileges to the 'test_user' by typing GRANT just once (something like GRANT SELECT, DE