[GENERAL] duplicate key violates unique constraint

2005-06-13 Thread ON.KG
Hi All! I have table: CREATE TABLE table1 ( ip char(15) NOT NULL, hits integer NOT NULL default '1', PRIMARY KEY (ip) ); So it's counting hits per each IP for current day and every day trancated by cron: TRUNCATE TABLE table1; before inserting or updating this table there're some

[GENERAL] Delay INSERT

2005-03-23 Thread ON.KG
Hi Does PostgreSQL have something like INSERT DELAYD - like it is used in MySQL? or any other way to delay inserting? Thanx ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining

[GENERAL] PL/Perl

2005-01-11 Thread ON.KG
Hi All! I'm trying in 'plperl' forking the processes by 'fork' function, but receiving this message Warning: pg_exec(): Query failed: ERROR: creation of function failed: 'fork' trapped by operation mask at (eval 2) line 11. Does it mean, that in 'plperl' I can't use 'fork' function???

[GENERAL] PL/Perl

2005-01-07 Thread ON.KG
Hi! Could I use use, require functions in plperl? for example, CREATE OR REPLACE FUNCTION perl_func (text) RETURNS real AS ' use HTTP::Request; use HTTP::Headers; return $value; ' LANGUAGE 'plperl'; with me it doesn't work and returns error message Query failed: ERROR: creation

Re: [GENERAL] A cascade on delete constraints deletes AFTER the source is gone??

2004-12-20 Thread ON.KG
Hi All! I need to make function which emulates table and returns setof columns of this table for example, i'm making query: SELECT * FROM my_table(user_id) and function CREATE OR REPLACE FUNCTION my_table (integer) RETURNS setof text AS ' DECLARE check_date date; max_date date; r

[GENERAL] Check if table exists

2004-12-17 Thread ON.KG
Hi ALL! I need to check before selection records from table - does this table exist How can i do that? Thanx in advance ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [GENERAL] Check if table exists

2004-12-17 Thread ON.KG
Richard Huxton Riccardo G. Facchini Thank you very much! ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

[GENERAL] Select Database

2004-12-02 Thread ON.KG
Hi All! How could I select another database without new connection? For example, in PHP+MySQL we have mysql_select_db('database_name'); Thanx ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ?

Re: [GENERAL] Select Database

2004-12-02 Thread ON.KG
Thanx JW On 12/2/2004 4:39 AM, ON.KG wrote: Hi All! How could I select another database without new connection? For example, in PHP+MySQL we have mysql_select_db('database_name'); JW You can't. An existing session cannot change the database connected to. JW Jan

[GENERAL] Trigger before insert

2004-11-25 Thread ON.KG
Hi all, === CREATE FUNCTION trigger_test_func() RETURNS trigger AS ' DECLARE cnt int4; BEGIN SELECT INTO cnt COUNT(*) FROM table_test WHERE ip = new.ip; IF cnt 50 THEN -- THERE THE INSERT HAS TO BE STOPED END IF; RETURN new; END;'

Re: [GENERAL] Trigger before insert

2004-11-25 Thread ON.KG
Hi! How could i stop Inserting record into table by some condition? RH RETURN null when using a before trigger. Or raise an exception to abort RH the whole transaction. Thanx ;) RETURN NULL works so as i need ---(end of broadcast)--- TIP 5:

[GENERAL] table name in pl/pgsql

2004-11-25 Thread ON.KG
New question: i have tables like table_20041124, table_20041125, etc... i'm trying to make function (for example): = CREATE FUNCTION get_count(text, text) RETURNS int2 AS ' DECLARE cnt int4; BEGIN SELECT INTO cnt COUNT(*) FROM table_$1

[GENERAL] PostgreSQL on Guest Host (VMWare)

2004-11-15 Thread ON.KG
Hi! Description: VMware 4.0 Main host is WinXP Pro (on FAT32) and Guest Host is WinXP Pro (on NTFS) On Guest Host - PostgreSQL 8.0-beta2-dev3 From Main host i'm trying to connect to PostgreSQL to Guest host But as a result i'm receiving next message: Connection Refused (0x274D/10061) Is