Re: [ADMIN] Functions

2008-09-15 Thread Scott Marlowe
On Mon, Sep 15, 2008 at 10:55 AM, c k <[EMAIL PROTECTED]> wrote: > Dear PG members, > I want to know that does begin and end in plpgsql are related to begin > transactions and commit? if yes/no how? No. a plpgsql function is a transaction in its entirety. If called within a transaction it inheri

Re: [ADMIN] functions

2008-08-04 Thread Lennin Caro
create a type and return this --- On Sat, 8/2/08, C K <[EMAIL PROTECTED]> wrote: > From: C K <[EMAIL PROTECTED]> > Subject: [ADMIN] functions > To: "pgsql-admin@postgresql.org" > Date: Saturday, August 2, 2008, 9:39 AM > Dear Friends, > I have written a function as follows. Here I need to get >

Re: [ADMIN] Functions

2008-06-24 Thread Rafael Domiciano
Hello, There a some differences from MySQL to PostgreSQL. In PostgreSQL we use Functions, what you called "Store Procedures", that do the same thing. In Postgres you can combine the Functions with "Triggers". Triggers are procedures that will be done when you do some U, I or D, you have to specifi

Re: [ADMIN] functions pg_get...

2007-11-15 Thread Ilan Volow
I've found the queries at this link to be very good for getting detailed postgresql schema information (table columns, triggers, etc) http://www.alberton.info/postgresql_meta_info.html -- Ilan On Nov 15, 2007, at 10:33 AM, König, Monika wrote: I'm looking for a postgres-funtion that shows me

Re: [ADMIN] functions pg_get...

2007-11-15 Thread Andrew Sullivan
On Thu, Nov 15, 2007 at 04:33:34PM +0100, "König, Monika" wrote: > I'm looking for a postgres-funtion that shows me the definition of a table. In psql, this is retrieved by \d [tablename]. By running psql -E, you'll be able to see how it generates that. (No, I'm not going to tell you, because I

Re: [ADMIN] Functions

2006-11-27 Thread imad
select prosrc from pg_proc where proname = ''; However you cannot see the code of C language function with this query. is that what you wanted? --Imad www.EnterpriseDB.com On 11/27/06, Doron Baranes <[EMAIL PROTECTED]> wrote: Hi, I'm new to postgres and i cant find how can i get a function

Re: [ADMIN] functions vs stored procedures

2005-07-24 Thread Ezequiel Tolnay
Alvaro Herrera wrote: Wow, incredible. You misread the whole documentation. I certainly did, I read it with more care this time. It is a great solution when we're required to return a single record with a custom type, which are few but there certainly are. I wonder if you know any tricks t

Re: [ADMIN] functions vs stored procedures

2005-07-15 Thread Alvaro Herrera
On Fri, Jul 15, 2005 at 10:57:04AM +1000, Ezequiel Tolnay wrote: > Thanks for the tip, but unfortunately id didn't address any of my > concerns. I alreay use the version 8, and I'm aware of the possibility > of using arrays for the results, which allows for some flexibility. But > unfortunately

Re: [ADMIN] functions vs stored procedures

2005-07-14 Thread Ezequiel Tolnay
Thanks for the tip, but unfortunately id didn't address any of my concerns. I alreay use the version 8, and I'm aware of the possibility of using arrays for the results, which allows for some flexibility. But unfortunately arrays are not records, and I'm limited to values of the same types, and

Re: [ADMIN] functions vs stored procedures

2005-07-14 Thread Tom Lane
Ezequiel Tolnay <[EMAIL PROTECTED]> writes: > I just can't get used to the annoyance of having to create a type for > every single function that returns a rowset. It is frankly cumbersome. Yup. See coming attractions at, eg, http://developer.postgresql.org/docs/postgres/xfunc-sql.html#XFUNC-OUTP

Re: [ADMIN] Functions and transactions

2005-03-11 Thread Tom Lane
Kris Kiger <[EMAIL PROTECTED]> writes: > Interesting. That makes sense, though. So, is there a good way to lock > a set of rows using SELECT FOR UPDATE in plpgsql? I assume using > PERFORM would yield the same problem, because it immediately discards > the results. I think PERFORM would work

Re: [ADMIN] Functions and transactions

2005-03-11 Thread Kris Kiger
Interesting. That makes sense, though. So, is there a good way to lock a set of rows using SELECT FOR UPDATE in plpgsql? I assume using PERFORM would yield the same problem, because it immediately discards the results. Thanks! Kris Tom Lane wrote: Kris Kiger <[EMAIL PROTECTED]> writes: In

Re: [ADMIN] Functions and transactions

2005-03-10 Thread Tom Lane
Kris Kiger <[EMAIL PROTECTED]> writes: > In your second paragraph, I think that you are saying that SELECT FOR > UPDATE only locks one row, even though the select itself may return > many. Am I mis-interpreting you? No, I'm saying that plpgsql's SELECT INTO operation only reads one row. The fac

Re: [ADMIN] Functions and transactions

2005-03-10 Thread Kris Kiger
In your second paragraph, I think that you are saying that SELECT FOR UPDATE only locks one row, even though the select itself may return many. Am I mis-interpreting you? Also, what do you mean by seizing on a non-active row? Your assumption about pkey_id is right, I meant for that to mean p

Re: [ADMIN] Functions and transactions

2005-03-10 Thread Tom Lane
Kris Kiger <[EMAIL PROTECTED]> writes: > Hmm.. I was trying simplify my function to get the point across with > minimal confusion. If you don't think there is enough detail, let me > know what is lacking and I will add the appropriate detail. The > function is executed BEFORE insert on table1.

Re: [ADMIN] Functions and transactions

2005-03-10 Thread Kris Kiger
Hmm.. I was trying simplify my function to get the point across with minimal confusion. If you don't think there is enough detail, let me know what is lacking and I will add the appropriate detail. The function is executed BEFORE insert on table1. Thanks again for the help all Kris Tom Lane

Re: [ADMIN] Functions and transactions

2005-03-09 Thread Tom Lane
Kris Kiger <[EMAIL PROTECTED]> writes: > Here is my problem. I have a function that is triggered on insert. For > simplicity's sake, lets say the function looks like this: > CREATE OR REPLACE FUNCTION dostuff_on_insert() RETURNS TRIGGER AS ' > DECLARE lockrows RECORD; > BEGIN > select into

Re: [ADMIN] Functions and transactions

2005-03-09 Thread Tsirkin Evgeny
I guess first we should understand why the insert B waits at all,the insert A did not commit ,right ,then how did it found any pkey_id = NEW.pkey_id? That means you have already had those while starting your experiment. So ,insert B wait for those "old" rows not for your insert (i mean an INSER

Re: [ADMIN] Functions and transactions

2005-03-09 Thread Kris Kiger
transaction_isolation --- read committed Running Postgres 7.4 btw Kris Tsirkin Evgeny wrote: What transaction level are you using? Evgeny. Kris Kiger wrote: Here is my problem. I have a function that is triggered on insert. For simplicity's sake, lets say the function looks

Re: [ADMIN] Functions and transactions

2005-03-09 Thread Tsirkin Evgeny
What transaction level are you using? Evgeny. Kris Kiger wrote: Here is my problem. I have a function that is triggered on insert. For simplicity's sake, lets say the function looks like this: CREATE OR REPLACE FUNCTION dostuff_on_insert() RETURNS TRIGGER AS ' DECLARE lockrows RECORD; BEGIN