Re: [GENERAL] Stored procedure version control

2016-07-03 Thread Mark Morgan Lloyd
Mark Morgan Lloyd wrote: Elsewhere, somebody was asking how people implemented version control for stored procedures on (MS) SQL Server. The consensus was that this is probably best managed by using scripts or command files to generate stored procedures etc., but does anybody have any

Re: [GENERAL] Stored procedure version control

2016-07-02 Thread Karsten Hilbert
On Thu, Jun 30, 2016 at 09:16:49AM -0500, Merlin Moncure wrote: > It's not really necessary to create version down scripts. In five > years of managing complex database environments we've never had to > roll a version back and likely never will; in the event of a disaster > it's probably better

Re: [GENERAL] Stored procedure version control

2016-07-01 Thread Rob Sargent
On 07/01/2016 06:17 PM, Jim Nasby wrote: On 6/30/16 9:16 AM, Merlin Moncure wrote: It's not really necessary to create version down scripts. In five years of managing complex database environments we've never had to roll a version back and likely never will; in the event of a disaster it's

Re: [GENERAL] Stored procedure version control

2016-07-01 Thread Jim Nasby
On 6/30/16 9:16 AM, Merlin Moncure wrote: It's not really necessary to create version down scripts. In five years of managing complex database environments we've never had to roll a version back and likely never will; in the event of a disaster it's probably better to restore from backup

Re: [GENERAL] Stored procedure version control

2016-06-30 Thread Merlin Moncure
On Wed, Jun 29, 2016 at 1:46 PM, Neil Anderson wrote: > On 2016-06-29 12:37 PM, Mark Morgan Lloyd wrote: >> >> Elsewhere, somebody was asking how people implemented version control >> for stored procedures on (MS) SQL Server. >> >> The consensus was that this is probably

Re: [GENERAL] Stored procedure version control

2016-06-30 Thread Mark Morgan Lloyd
Mike Sofen wrote: -Original Message- From: Mark Morgan Lloyd Sent: Thursday, June 30, 2016 2:41 AM Neil Anderson wrote: On 2016-06-29 12:37 PM, Mark Morgan Lloyd wrote: Elsewhere, somebody was asking how people implemented version control for stored procedures on (MS) SQL

Re: [GENERAL] Stored procedure version control

2016-06-30 Thread Mike Sofen
-Original Message- >From: Mark Morgan Lloyd Sent: Thursday, June 30, 2016 2:41 AM >Neil Anderson wrote: >> On 2016-06-29 12:37 PM, Mark Morgan Lloyd wrote: >>> Elsewhere, somebody was asking how people implemented version control >>> for stored procedures on (MS) SQL Server. >>>

Re: [GENERAL] Stored procedure version control

2016-06-30 Thread Mark Morgan Lloyd
Neil Anderson wrote: On 2016-06-29 12:37 PM, Mark Morgan Lloyd wrote: Elsewhere, somebody was asking how people implemented version control for stored procedures on (MS) SQL Server. The consensus was that this is probably best managed by using scripts or command files to generate stored

Re: [GENERAL] Stored procedure version control

2016-06-29 Thread Neil Anderson
On 2016-06-29 12:37 PM, Mark Morgan Lloyd wrote: Elsewhere, somebody was asking how people implemented version control for stored procedures on (MS) SQL Server. The consensus was that this is probably best managed by using scripts or command files to generate stored procedures etc., but does

Re: [GENERAL] Stored procedure version control

2016-06-29 Thread Neil Anderson
On 2016-06-29 12:37 PM, Mark Morgan Lloyd wrote: Elsewhere, somebody was asking how people implemented version control for stored procedures on (MS) SQL Server. The consensus was that this is probably best managed by using scripts or command files to generate stored procedures etc., but does

Re: [GENERAL] Stored procedure version control

2016-06-29 Thread Peter Devoy
>does anybody have any comment on that from the POV of PostgreSQL? Might be overkill but you could deploy your procedure as an extension because extensions come with version control: https://www.postgresql.org/docs/current/static/sql-createextension.html Another option might be to hack something

Re: [GENERAL] Stored procedure version control

2016-06-29 Thread Scott Marlowe
On Wed, Jun 29, 2016 at 12:00 PM, Adrian Klaver wrote: > On 06/29/2016 09:37 AM, Mark Morgan Lloyd wrote: >> >> Elsewhere, somebody was asking how people implemented version control >> for stored procedures on (MS) SQL Server. >> >> The consensus was that this is

Re: [GENERAL] Stored procedure version control

2016-06-29 Thread Adrian Klaver
On 06/29/2016 09:37 AM, Mark Morgan Lloyd wrote: Elsewhere, somebody was asking how people implemented version control for stored procedures on (MS) SQL Server. The consensus was that this is probably best managed by using scripts or command files to generate stored procedures etc., but does

[GENERAL] Stored procedure version control

2016-06-29 Thread Mark Morgan Lloyd
Elsewhere, somebody was asking how people implemented version control for stored procedures on (MS) SQL Server. The consensus was that this is probably best managed by using scripts or command files to generate stored procedures etc., but does anybody have any comment on that from the POV of

Re: [GENERAL] stored procedure variable names

2015-02-20 Thread Igor Neyman
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of inspector morse Sent: Thursday, February 19, 2015 7:58 PM To: pgsql-general@postgresql.org Subject: [GENERAL] stored procedure variable names In all other DBMS, the variable names have

Re: [GENERAL] stored procedure variable names

2015-02-19 Thread Pavel Stehule
2015-02-20 1:57 GMT+01:00 inspector morse inspectormors...@gmail.com: In all other DBMS, the variable names have a distinctive character to differentiate between variables and column names: Example: SQL Server uses @ MySql uses ? Oracle uses : Firebirdsql uses : It makes it easier to

Re: [GENERAL] stored procedure variable names

2015-02-19 Thread Adrian Klaver
On 02/19/2015 04:57 PM, inspector morse wrote: In all other DBMS, the variable names have a distinctive character to differentiate between variables and column names: Example: SQL Server uses @ MySql uses ? Oracle uses : Firebirdsql uses : It makes it easier to write and manage queries

Re: [GENERAL] stored procedure variable names

2015-02-19 Thread Jerry Sievers
inspector morse inspectormors...@gmail.com writes: In all other DBMS, the variable names have a distinctive character to differentiate between variables and column names: Example: SQL Server uses @ MySql uses ? Oracle uses : Firebirdsql uses : It makes it easier to write and manage

[GENERAL] stored procedure variable names

2015-02-19 Thread inspector morse
In all other DBMS, the variable names have a distinctive character to differentiate between variables and column names: Example: SQL Server uses @ MySql uses ? Oracle uses : Firebirdsql uses : It makes it easier to write and manage queries especially in stored procedures. Just compare the

Re: [GENERAL] stored procedure variable names

2015-02-19 Thread inspector morse
Yeah, I'm using plpgsql. Actually nevermind on this. I was able to patch my data access utility so it adds a prefix when calling the stored function and then remove it again before returning for front end processing. On Thu, Feb 19, 2015 at 8:44 PM, Adrian Klaver adrian.kla...@aklaver.com wrote:

Re: [GENERAL] stored procedure variable names

2015-02-19 Thread Tom Lane
inspector morse inspectormors...@gmail.com writes: Is there any plan to add a character to differentiate between variables? No. You're free to use a naming convention yourself, of course, but we're not going to break every stored procedure in sight in order to impose one.

Re: [GENERAL] Stored procedure workflow question

2014-12-11 Thread Andy Colson
On 12/10/2014 6:53 PM, Israel Brewster wrote: Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following: - Create/edit the desired function in my DB Commands text file - Copy and paste function into my development database - Test - repeat above

[GENERAL] Stored procedure workflow question

2014-12-10 Thread Israel Brewster
Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following:- Create/edit the desired function in my "DB Commands" text file- Copy and paste function into my development database- Test- repeat above until it works as desired- Copy and paste function

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Gavin Flower
On 11/12/14 13:53, Israel Brewster wrote: Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following: - Create/edit the desired function in my DB Commands text file - Copy and paste function into my development database - Test - repeat above

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Adrian Klaver
On 12/10/2014 04:53 PM, Israel Brewster wrote: Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following: - Create/edit the desired function in my DB Commands text file - Copy and paste function into my development database - Test - repeat above

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Rob Sargent
On 12/10/2014 05:53 PM, Israel Brewster wrote: Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following: - Create/edit the desired function in my DB Commands text file - Copy and paste function into my development database - Test - repeat

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Adrian Klaver
On 12/10/2014 05:03 PM, Gavin Flower wrote: On 11/12/14 13:53, Israel Brewster wrote: Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following: - Create/edit the desired function in my DB Commands text file - Copy and paste function into my

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Paul Jungwirth
How do you handle DDL changes in general? I would treat stored procedures the same way. For instance Ruby on Rails has database migrations where you write one method to apply the DDL change and another to revert it, like this: def up add_column :employees, :manager_id, :integer

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Melvin Davidson
I suggest you download and install PgAdmin. http://www.pgadmin.org/index.php It makes review of functions and other database objects, as well as maintenance, a lot easier. Otherwise, you can just use psql eg: psql your_database \o /some_dir/your_proc_filename \sf+ your_proc \q Your function

Re: [GENERAL] Stored Procedure table/column args

2013-09-08 Thread Sameer Thakur
Hello, Create a view as described @ http://www.postgresql.org/message-id/flat/3c055b7e.bb52f...@but.auc.dk#3c055b7e.bb52f...@but.auc.dk create view my_tbldescription as select u.usename, t.typname AS tblname, a.attname, a.atttypid, n.typname AS atttypname, int4larger(a.attlen, a.atttypmod

[GENERAL] Stored Procedure table/column args

2013-09-02 Thread Bret Stern
'psuedo Can you create stored procedures that are built from parameters as below, or does this defeat the pre-compiled purpose of an SP? create function item_exists (tbl character varying, col character varying, col_val character varying) DECLARE x integer; PERFORM col FROM tbl WHERE

Re: [GENERAL] Stored Procedure table/column args

2013-09-02 Thread Adrian Klaver
On 09/02/2013 06:06 PM, Bret Stern wrote: 'psuedo Can you create stored procedures that are built from parameters as below, or does this defeat the pre-compiled purpose of an SP? create function item_exists (tbl character varying, col character varying, col_val character varying) DECLARE x

Re: [GENERAL] Stored Procedure table/column args

2013-09-02 Thread Bret Stern
On Mon, 2013-09-02 at 18:20 -0700, Adrian Klaver wrote: On 09/02/2013 06:06 PM, Bret Stern wrote: 'psuedo Can you create stored procedures that are built from parameters as below, or does this defeat the pre-compiled purpose of an SP? create function item_exists (tbl character

[GENERAL] stored procedure slower when called through c client than pgadmin

2013-03-08 Thread Bradley Russell
We have a stored procedure that takes two integers as parameters, a start date and a stop date. It runs some calculations on a table and updates some columns in the same table. The table being updated is partitioned. The server version is 9.1.8. When we run this stored procedure through

Re: [GENERAL] stored procedure slower when called through c client than pgadmin

2013-03-08 Thread Pavel Stehule
Hello 2013/3/8 Bradley Russell bradley.russ...@npcinternational.com: We have a stored procedure that takes two integers as parameters, a start date and a stop date. It runs some calculations on a table and updates some columns in the same table. The table being updated is partitioned.

Re: [GENERAL] stored procedure slower when called through c client than pgadmin

2013-03-08 Thread Bradley Russell
...@gmail.com] Sent: Friday, March 08, 2013 10:56 AM To: Bradley Russell Cc: PostgreSQL General (pgsql-general@postgresql.org) Subject: Re: [GENERAL] stored procedure slower when called through c client than pgadmin Hello 2013/3/8 Bradley Russell bradley.russ...@npcinternational.com: We have a stored

Re: [GENERAL] stored procedure slower when called through c client than pgadmin

2013-03-08 Thread Pavel Stehule
[mailto:pavel.steh...@gmail.com] Sent: Friday, March 08, 2013 10:56 AM To: Bradley Russell Cc: PostgreSQL General (pgsql-general@postgresql.org) Subject: Re: [GENERAL] stored procedure slower when called through c client than pgadmin Hello 2013/3/8 Bradley Russell bradley.russ

Re: [GENERAL] stored procedure slower when called through c client than pgadmin

2013-03-08 Thread Bradley Russell
, 2013 11:09 AM To: Bradley Russell Cc: PostgreSQL General (pgsql-general@postgresql.org) Subject: Re: [GENERAL] stored procedure slower when called through c client than pgadmin 2013/3/8 Bradley Russell bradley.russ...@npcinternational.com: I will see if I can strip the code down more to a smaller

[GENERAL] stored procedure code

2013-02-23 Thread Derek Perak
Hi, I would like to learn about how stored procedures are handled in postgres. In particular, I'd like to learn how plpgsql procedures are compiled and stored, and how they (both plpgsql and C procedures) interact with the optimizer during planning. Would appreciate if someone can point out

Re: [GENERAL] stored procedure code

2013-02-23 Thread Adrian Klaver
On 02/23/2013 02:49 PM, Derek Perak wrote: Hi, I would like to learn about how stored procedures are handled in postgres. In particular, I'd like to learn how plpgsql procedures are compiled and stored, and how they (both plpgsql and C procedures) interact with the optimizer during planning.

Re: [GENERAL] stored procedure multiple call call question

2012-10-13 Thread Jasen Betts
On 2012-10-02, Chris McDonald chrisjonmcdon...@gmail.com wrote: Hi, If I had a single table targ to insert into I would do an INSERT INTO targ SELECT thiscol, thatcol, theothercol FROM FOO. The problem is that I have tables targ1, targ2, targn to insert things into and a nice stored

Re: [GENERAL] stored procedure multiple call call question

2012-10-03 Thread Chris McDonald
Thanks very much for that David - really appreciate your response - it works like a dream c On Tuesday, 2 October 2012 19:42:59 UTC+1, Chris McDonald wrote: Hi, If I had a single table targ to insert into I would do an INSERT INTO targ SELECT thiscol, thatcol, theothercol

[GENERAL] stored procedure multiple call call question

2012-10-02 Thread Chris McDonald
Hi, If I had a single table targ to insert into I would do an INSERT INTO targ SELECT thiscol, thatcol, theothercol FROM FOO. The problem is that I have tables targ1, targ2, targn to insert things into and a nice stored procedure myproc which does the insertion into all 3 tables - problem

Re: [GENERAL] stored procedure multiple call call question

2012-10-02 Thread Chris McDonald
my apologies - forgot to say I am on postgresql 8.4.9 on Fedora Linux x86_64 c -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] stored procedure multiple call call question

2012-10-02 Thread David Johnston
If I had a single table targ to insert into I would do an INSERT INTO targ SELECT thiscol, thatcol, theothercol FROM FOO. The problem is that I have tables targ1, targ2, targn to insert things into and a nice stored procedure myproc which does the insertion into all 3 tables - problem

[GENERAL] Stored Procedure Record Updates using For Loops - Postgres 8.1

2012-02-28 Thread Lummis, Patrick J
Hi, I'm trying to update a record within a for loop and at the point of updating I get the following syntax error: ERROR: syntax error at or near $1 LINE 1: update $1 set wfstatus='failed' ^ QUERY: update $1 set wfstatus='failed' CONTEXT: SQL statement in PL/PgSQL

Re: [GENERAL] Stored Procedure Record Updates using For Loops - Postgres 8.1

2012-02-28 Thread Bartosz Dmytrak
Hi, instead of *update workorderRecord set wfstatus='failed'; * try: workorderRecord.wfstatus := 'failed'; I haven't tested, but workorderRecord is ROWTYPE, so shouldn't be updated like a table. I'm sticked to 9.1, hope the same is for 8.1

Re: [GENERAL] Stored Procedure Record Updates using For Loops - Postgres 8.1

2012-02-28 Thread Lummis, Patrick J
, February 28, 2012 12:24 PM To: Lummis, Patrick J Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Stored Procedure Record Updates using For Loops - Postgres 8.1 Hi, instead of update workorderRecord set wfstatus='failed'; try: workorderRecord.wfstatus := 'failed'; I haven't tested

Re: [GENERAL] Stored Procedure Record Updates using For Loops - Postgres 8.1

2012-02-28 Thread Bartosz Dmytrak
, Patrick J *Cc:* pgsql-general@postgresql.org *Subject:* Re: [GENERAL] Stored Procedure Record Updates using For Loops - Postgres 8.1 Hi, instead of *update workorderRecord set wfstatus='failed'; * try: workorderRecord.wfstatus := 'failed'; I haven't tested, but workorderRecord

Re: [GENERAL] Stored Procedure Record Updates using For Loops - Postgres 8.1

2012-02-28 Thread Adrian Klaver
On Tuesday, February 28, 2012 12:35:58 pm Lummis, Patrick J wrote: Hi Bartek, Thanks for the quick response. Syntax error cleared up and loads fine but executing the stored procedure fails to update the row. From the usage I guessing this function is not being used in a trigger. As such

Re: [GENERAL] Stored Procedure Record Updates using For Loops - Postgres 8.1

2012-02-28 Thread Lummis, Patrick J
Indeed there is an id field. That's the ticket! And thanks much. -Original Message- From: Adrian Klaver [mailto:adrian.kla...@gmail.com] Sent: Tuesday, February 28, 2012 12:48 PM To: pgsql-general@postgresql.org Cc: Lummis, Patrick J; Bartosz Dmytrak Subject: Re: [GENERAL] Stored

[GENERAL] Stored procedure name

2011-08-17 Thread Murat Kabilov
Hi, Is there any way to get current stored procedure name? Best Regards,

Re: [GENERAL] stored procedure: RETURNS record

2009-09-26 Thread InterRob
Thank you for your response; I understand the information provided was somewhat limited; I am happy to provide a bit more though: I notice you guys have quite experience modeling data... What I am trying to do is: building views on a base table, extended by one or more columns, extracted (hence

Re: [GENERAL] stored procedure: RETURNS record

2009-09-26 Thread Rob Marjot
Thank you for your response; I understand the information provided was somewhat limited; I am happy to provide a bit more though: I notice you guys have quite experience modeling data... What I am trying to do is: building views on a base table, extended by one or more columns, extracted (hence

[GENERAL] stored procedure: RETURNS record

2009-09-25 Thread InterRob
Dear list, I am trying to find out whether I can use the record type as a polymorphic return type to return multiple columns, to be determined at runtime. In fact, I'm trying to write a function that provides a generic implementation of some deserialization of a certain field. The prototype of

Re: [GENERAL] stored procedure: RETURNS record

2009-09-25 Thread Alban Hertroys
On 25 Sep 2009, at 18:34, InterRob wrote: Unfortunately, this results in ONE row, with ONE column. E.g.: MYDB=# select * from (SELECT deserialize(kvp) FROM kvp) ss; deserialize --- (1,2) (1 row) I guess I am seeking to prototype the anonymous row layout in the above SQL statement?

Re: [GENERAL] stored procedure: RETURNS record

2009-09-25 Thread Rob Marjot
Still no luck... To clarify a bit, take this example: CREATE OR REPLACE FUNCTION transpose() RETURNS record AS $BODY$ DECLARE output RECORD; BEGIN SELECT * INTO output FROM (VALUES(1,2)) as tbl(first,second); RETURN output; END;$BODY$ LANGUAGE 'plpgsql' STABLE COST 100; Now, I

Re: [GENERAL] stored procedure: RETURNS record

2009-09-25 Thread Tom Lane
Rob Marjot r...@marjot-multisoft.com writes: Any thoughts on how to make sure multiple columns are returned; without specifying this in the function's prototype return clause? If you want SELECT * FROM to expand to multiple columns, the names and types of those columns *must* be available at

Re: [GENERAL] stored procedure: RETURNS record

2009-09-25 Thread Merlin Moncure
On Fri, Sep 25, 2009 at 2:40 PM, Rob Marjot r...@marjot-multisoft.com wrote: Still no luck... To clarify a bit, take this example: CREATE OR REPLACE FUNCTION transpose()   RETURNS record AS $BODY$ DECLARE    output RECORD;  BEGIN    SELECT * INTO output FROM (VALUES(1,2)) as

[GENERAL] stored procedure compilation error checking

2008-08-11 Thread Mani, Arun
I am fairly new to Postgres. I noticed that the stored procedures written in pgplsql are checked only for syntax errors and nothing more at compile time. It does not even do that basic error checking like if the table/field names or variable names used in the procedure are even valid. This

Re: [GENERAL] stored procedure compilation error checking

2008-08-11 Thread Peter Eisentraut
On Monday 11 August 2008 20:15:37 Mani, Arun wrote: Is there a configuration setting to increase the error checking level or any tool available to do the same. No -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

[GENERAL] Stored procedure issue

2007-12-01 Thread Dragan Zubac
Hello I have a stored procedure which does the billing stuff in our system,it works ok,but if I put in production,where there is some 5-10 billing events per second,the whole database slows down. It won't even drop some test table,reindex,vacuum,things which were done before in the blink of an

Re: [GENERAL] Stored procedure issue

2007-12-01 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/01/07 20:40, Dragan Zubac wrote: Hello I have a stored procedure which does the billing stuff in our system,it works ok,but if I put in production,where there is some 5-10 billing events per second,the whole database slows down. It won't

Re: [GENERAL] Stored procedure for generation next sequence value

2007-10-29 Thread Joshua D. Drake
On Mon, 29 Oct 2007 23:59:59 + Frank Church [EMAIL PROTECTED] wrote: Is there a built in function for retrieving the next value of a sequence and updating the sequence counter? The docs are amazing: http://www.postgresql.org/docs/current/static/functions-sequence.html Sincerely,

[GENERAL] Stored procedure for generation next sequence value

2007-10-29 Thread Frank Church
Is there a built in function for retrieving the next value of a sequence and updating the sequence counter? ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [GENERAL] Stored procedure for generation next sequence value

2007-10-29 Thread Michael Glaesemann
On Oct 29, 2007, at 18:59 , Frank Church wrote: Is there a built in function for retrieving the next value of a sequence and updating the sequence counter? http://www.postgresql.org/docs/faqs.FAQ.html#item4.11.2 http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html Michael

[GENERAL] stored procedure

2007-09-07 Thread genesis
Im newbie with postgresql i want to know how to create a stored procedure that retrieve records something like SELECT * FROM TABLE1 WHERE TABLE1.ID = 'PARAMETER' appreciate any help, links etc... thanks Germán Fonseca P. ---(end of

Re: [GENERAL] stored procedure

2007-09-07 Thread Rodrigo De León
On 9/7/07, genesis [EMAIL PROTECTED] wrote: appreciate any help, links etc... See: http://www.postgresql.org/docs/8.2/static/xfunc-sql.html#AEN36437 ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-04 Thread Dave Page
Richard Huxton wrote: Dave Page wrote: Richard Huxton wrote: Charles Pare wrote: Wow, it works great Thank's for the quick answer 12 minutes? I've seen bug-patches turned around quicker than that by Tom ;-) Yeah, that's really quite disappointing Richard - you need to pull your socks up

[GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Charles Pare
Hi, in a stored procedure, if I do COPY table FROM 'mypath' DELIMITERS '\t'; it works but if my path is a text variable which contain my path, i.e.COPY table FROM mytextvar DELIMITERS '\t'; it doesn't work, I get ERROR: syntax error at or near $1SQL state: 42601Context: SQL statement in

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Richard Huxton
Charles Pare wrote: Hi, in a stored procedure, if I do COPY table FROM 'mypath' DELIMITERS '\t'; it works but if my path is a text variable which contain my path, i.e.COPY table FROM mytextvar DELIMITERS '\t'; it doesn't work, I get ERROR: syntax error at or near $1SQL state: 42601Context: SQL

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Charles Pare
Wow, it works greatThank's for the quick answerThe Postgres community is amazing!Charles Date: Tue, 3 Jul 2007 20:01:03 +0100 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: pgsql-general@postgresql.org Subject: Re: [GENERAL] Stored Procedure: Copy table from; path = text variable Charles

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Richard Huxton
Charles Pare wrote: Wow, it works great Thank's for the quick answer 12 minutes? I've seen bug-patches turned around quicker than that by Tom ;-) The Postgres community is amazing! Mostly by volunteers helping out on lists :-) There's always someone out there you can lend a helping hand

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Dave Page
Richard Huxton wrote: Charles Pare wrote: Wow, it works great Thank's for the quick answer 12 minutes? I've seen bug-patches turned around quicker than that by Tom ;-) Yeah, that's really quite disappointing Richard - you need to pull your socks up :-) /D ---(end

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Richard Huxton
Dave Page wrote: Richard Huxton wrote: Charles Pare wrote: Wow, it works great Thank's for the quick answer 12 minutes? I've seen bug-patches turned around quicker than that by Tom ;-) Yeah, that's really quite disappointing Richard - you need to pull your socks up :-) Would have been

[GENERAL] Stored Procedure: COPY table FROM (where path is a text variable)

2007-07-03 Thread Charles Pare
Hi, in a stored procedure, if I do COPY table FROM 'mypath' DELIMITERS '\t'; it works but if my path is a text variable, i.e.COPY table FROM mytextvar DELIMITERS '\t'; it doesn't work, I get ERROR: syntax error at or near $1SQL state: 42601Context: SQL statement in PL/PgSQL function parseinsert

Re: [GENERAL] Stored procedure

2007-05-04 Thread Thorsten Kraus
:[EMAIL PROTECTED] On Behalf Of Thorsten Kraus Sent: Thursday, May 03, 2007 5:27 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] Stored procedure Hi, thanks for your answer, but I don't get the point. Perhaps you can give me a small example how to get the EXECUTE into a stored procedure

Re: [GENERAL] Stored procedure

2007-05-04 Thread Hakan Kocaman
From: Thorsten Kraus [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 5:36 PM To: Hakan Kocaman; pgsql-general@postgresql.org Subject: Re: [GENERAL] Stored procedure Hi, thank you

[GENERAL] Stored procedure

2007-05-03 Thread Thorsten Kraus
Hi NG, I want to write a stored procedure which creates a table in my PostgreSQL database. The procedure has one input parameter: the table name. Here is my first try, but that does not work: --

Re: [GENERAL] Stored procedure

2007-05-03 Thread Hakan Kocaman
, 2007 5:00 PM To: pgsql-general@postgresql.org Subject: [GENERAL] Stored procedure Hi NG, I want to write a stored procedure which creates a table in my PostgreSQL database. The procedure has one input parameter: the table name. Here

Re: [GENERAL] Stored procedure

2007-05-03 Thread Thorsten Kraus
Klötsch, Marco de Gast From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thorsten Kraus Sent: Thursday, May 03, 2007 5:00 PM To: pgsql-general@postgresql.org Subject: [GENERAL] Stored procedure

Re: [GENERAL] Stored procedure

2007-05-03 Thread Hakan Kocaman
Subject: Re: [GENERAL] Stored procedure Hi, thanks for your answer, but I don't get the point. Perhaps you can give me a small example how to get the EXECUTE into a stored procedure. Regards Hakan Kocaman schrieb: Hi, Try EXECUTE http://www.postgresql.org/docs/8.2

[GENERAL] Stored Procedure Speed

2007-04-25 Thread Scott Schulthess
Hey Ya'll, I'm a little puzzled by the speed of the stored procedures I am writing. Here is the query alone in pgAdmin select distinct featuretype from gnis_placenames where state='CT' TIME: 312+16ms Here is a stored procedure create or replace function getfeaturetypes(text)

Re: [GENERAL] Stored Procedure Speed

2007-04-25 Thread Richard Huxton
Scott Schulthess wrote: Hey Ya'll, I'm a little puzzled by the speed of the stored procedures I am writing. Here is the query alone in pgAdmin select distinct featuretype from gnis_placenames where state='CT' TIME: 312+16ms Here is a stored procedure create or replace function

Re: [GENERAL] Stored Procedure Speed

2007-04-25 Thread Tom Lane
Richard Huxton [EMAIL PROTECTED] writes: I must say I thought recent versions of PG delayed planning the query until first call though. No, you're thinking of parameterized queries sent through the FE/BE protocol. Functions still plan without any assumptions about parameter values.

Re: [GENERAL] Stored Procedure Speed

2007-04-25 Thread Richard Huxton
Tom Lane wrote: Richard Huxton [EMAIL PROTECTED] writes: I must say I thought recent versions of PG delayed planning the query until first call though. No, you're thinking of parameterized queries sent through the FE/BE protocol. Functions still plan without any assumptions about parameter

Re: [GENERAL] Stored Procedure Speed

2007-04-25 Thread Tom Lane
Richard Huxton [EMAIL PROTECTED] writes: Ah, fair enough. I *am* right in thinking that trivial SQL functions will have their expressions inlined though? Yes. regards, tom lane ---(end of broadcast)--- TIP 5: don't

Re: [GENERAL] Stored Procedure / function and their result

2007-03-20 Thread Albe Laurenz
Alain Roger wrote: I would like to know if there is a better way how to retrieve result from a stored procedure (function) than to use 'AS res(col1 varchar, col2 timestamp,..)' for example, here is a stored procedure : CREATE OR REPLACE FUNCTION SP_A_003(username VARCHAR) RETURNS

[GENERAL] Stored Procedure / function and their result

2007-03-19 Thread Alain Roger
Hi, I would like to know if there is a better way how to retrieve result from a stored procedure (function) than to use 'AS res(col1 varchar, col2 timestamp,..)' for example, here is a stored procedure : CREATE OR REPLACE FUNCTION SP_A_003(username VARCHAR) RETURNS SETOF RECORD AS $BODY$

Re: [GENERAL] Stored Procedure / function and their result

2007-03-19 Thread Martijn van Oosterhout
On Mon, Mar 19, 2007 at 01:54:14PM +0100, Alain Roger wrote: Hi, I would like to know if there is a better way how to retrieve result from a stored procedure (function) than to use 'AS res(col1 varchar, col2 timestamp,..)' Sure, create a type with the relevent field name and use that in you

[GENERAL] Stored procedure

2007-03-13 Thread Alain Roger
Hi, I have a stored procedure which returns a SETOF RECORD. so basically a partial rowtype from a table. to execute the query in PHP, i must write : select * from myschema.sp_a_002('username') as result(Column1 varchar); to get the result. However, is there another to get the result without

Re: [GENERAL] Stored procedure

2007-03-13 Thread David Legault
On 3/13/07, Alain Roger [EMAIL PROTECTED] wrote: Hi, I have a stored procedure which returns a SETOF RECORD. so basically a partial rowtype from a table. to execute the query in PHP, i must write : select * from myschema.sp_a_002('username') as result(Column1 varchar); to get the result.

Re: [GENERAL] Stored procedure

2007-03-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-03-13 18:29:36 +0100: Hi, I have a stored procedure which returns a SETOF RECORD. so basically a partial rowtype from a table. to execute the query in PHP, i must write : select * from myschema.sp_a_002('username') as result(Column1 varchar); to get the

Re: [GENERAL] stored procedure optimisation...

2007-02-27 Thread Albe Laurenz
Anton Melser wrote: I need to analyse some html to get some links out, and with only 25 lines in exports_tmp_links (and text_to_parse no more than around 10KB) this function has taken 10 minutes and counting. Something horribly wrong is going on here! Can someone give me any pointers? I bet

Re: [GENERAL] stored procedure optimisation...

2007-02-27 Thread Anton Melser
RAISE NOTICE 'I am here, and myvar = % and thatvar = %', myvar, thatvar; Thanks... it is indeed a gem that little instruction!!! Cheers Anton ---(end of broadcast)--- TIP 6: explain analyze is your friend

[GENERAL] stored procedure optimisation...

2007-02-26 Thread Anton Melser
Hi, I need to analyse some html to get some links out, and with only 25 lines in exports_tmp_links (and text_to_parse no more than around 10KB) this function has taken 10 minutes and counting. Something horribly wrong is going on here! Can someone give me any pointers? Cheers Anton delete from

Re: [GENERAL] Stored Procedure examples

2007-02-15 Thread Dave Page
Walter Vaughan wrote: Vladimir Zelinski wrote: I'm struggling to create a stored procedure. I searched on Internet for several hours trying to find a simple example, but didn't find anything. I saw dozens of questions how to create a procedure without any responses. I searched on

Re: [GENERAL] Stored Procedure examples

2007-02-15 Thread Peter Eisentraut
Dave Page wrote: pgAdmin defines a stored procedure as: - A function on EnterpriseDB 8.0 or above, written in edbspl. Why does EnterpriseDB determine what is a stored procedure in PostgreSQL? Shouldn't that be limited to their own version of pgAdmin? - A function written in EnterpriseDB or

Re: [GENERAL] Stored Procedure examples

2007-02-15 Thread Dave Page
Peter Eisentraut wrote: Dave Page wrote: pgAdmin defines a stored procedure as: - A function on EnterpriseDB 8.0 or above, written in edbspl. Why does EnterpriseDB determine what is a stored procedure in PostgreSQL? Shouldn't that be limited to their own version of pgAdmin? The

Re: [GENERAL] Stored Procedure examples

2007-02-15 Thread Peter Eisentraut
Dave Page wrote: Because PostgreSQL allows return values and IN/OUT/INOUT parameters on the same routine, we use the first part of the definition only when making our distinction. Source: section 4.27, SQL-invoked Routines in SWD-02-Foundation-2003-09 That same clause also contains various

  1   2   >