[GENERAL] cursors as table sources

2006-01-11 Thread Peter Filipov

Hi,

Is the idea to use cursors as table sources good?
Do you plan to implement it in the future and if you plan will it be soon?

Regards,
Peter Filipov

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

---(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


[GENERAL] strange behaviour in plpgsql:null arguments

2005-11-28 Thread Peter Filipov

Hi, I think I found something that is strange.
I can't detect whether i passed a NULL to stored procedure
in plpgsql when it happens that I use composites
I warn that I haven't read the sql standards though.
Here is the code:

CREATE TYPE ttype AS (
t1 int,
t2 int
);

CREATE OR REPLACE FUNCTION ttypetest(t ttype) RETURNS ttype AS $$
BEGIN
IF t IS NULL THEN
RAISE EXCEPTION 'NULL input';
END IF;
RETURN t;
END
$$ LANGUAGE plpgsql;

SELECT ttypetest(NULL);

I also find it quite difficult to unset an element from array in postgres.


Regards,
Peter Filipov

---(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


[GENERAL] insert on duplicate update?

2005-11-09 Thread Peter Filipov

hi,
is there in postgres anything similar to:
insert  on duplicate update?
here is the problem i need a solution for:
I need to insert in pg_type a row which was previously selected from there  
and

with slight modifications, the problem is that when i try to insert the row
there might be a row with the same 'typname' which is sort of primary key.
The second problem is that when doing those operations i don't want to  
depend

on the specific structure of the pg_type catalog. I want my procedure
to work even if in some future release additional columns to pg_type are  
added.
So what i want is to insert a row in a table that was previously selected  
from the same
table but if there is primary key collision i want to update the row that  
collided. And

all these without being dependant on the table structure.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq


Re: [GENERAL] I just can't get it:record_in, record_out(I know i try to do something postgres is not developed for but there are many 'buts')

2005-11-07 Thread Peter Filipov
I figured out how to do it, myself. Just wondering why nobody answers me,  
maybe I ask dumb questions 

Cheers!

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

---(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


[GENERAL] records to text representation

2005-11-04 Thread Peter Filipov

Is there any way to covert an instance of a composite type to text,
to store it in a text column, and then to recreate the original object?
For example:

create type test as (a integer, b text);
create tble tstore (s text);

insert into tstore values((someproc((row(1, 'tst'))::test))::text);
select (someproc(s))::test from tstore;

BTW, I succeeded to create an array of composite types althought I think
i met somewhere in the docs that these are still not supported.
I did it by fiddling with the system catalogs.

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[GENERAL] I just can't get it:record_in, record_out(I know i try to do something postgres is not developed for but there are many 'buts')

2005-11-04 Thread Peter Filipov

This is what i can't get right:


CREATE type tst_tst as (a integer, b text);

CREATE OR REPLACE FUNCTION tst_store(a anyelement) RETURNS text AS $$
BEGIN
RETURN textin(record_out(a));
END
$$ LANGUAGE PLPGSQL;


create or replace function tst_load1(a text) returns tst_tst as $$
declare
b tst_tst;
c text;
begin
c := record_in(textout(a), 'tst_tst'::regtype::oid, 0);
c := 'select row'  || c || '::tst_tst';
raise notice 'boza:%', c;
execute c into b;
return b;
end
$$ language plpgsql;

Somebody help please

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[GENERAL] Postgres Object-oriented db

2005-11-01 Thread Peter Filipov
Q1: Can someone point me to documentation as to how to fully utilize the  
object part (to say so)

of Postgres?
Q2: Will arrays of composite types be supported soon?


--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

---(end of broadcast)---
TIP 6: explain analyze is your friend