Re: [SQL] execute

2013-04-27 Thread Jasen Betts
On 2013-04-25, Mauricio Cruz wrote: > declare > > aCad > text[][] > > begin > > ... > > execute 'aCad:=aCad > array[['||var1||','||var2||']]' execute 'select array[['||var1||','||var2||']]' into acad; -- ⚂⚃ 100% natural -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) T

Re: [SQL] execute

2013-04-25 Thread Sergey Konoplev
On Thu, Apr 25, 2013 at 9:17 AM, Mauricio Cruz wrote: > execute 'aCad:=aCad array[['||var1||','||var2||']]' What are you going to do using this construction aCad:=aCad array[['||var1||','||var2||']] ? I can not understand the meaning. -- Kind regards, Sergey Konoplev Database and Software Con

[SQL] execute

2013-04-25 Thread Mauricio Cruz
Hi every one, I'm trying to do the follow: declare aCad text[][] begin ... execute 'aCad:=aCad array[['||var1||','||var2||']]' ... end; language plpgsql but I get the follow error: sintax erro near to "aCad" aCad := aCad || array[rCad.cmp,rSql.codfor] ^ I guess I sho

Re: [SQL] EXECUTE with a prepared plan and NULL

2009-01-04 Thread Tom Lane
"sergey kapustin" writes: > The thing is, that if i one of the parameters is NULL, then string s becomes > NULL also ( because NULL||"any string" = NULL) and as a result i get this > error - > ERROR: cannot EXECUTE a null querystring quote_nullable() might help. regards,

[SQL] EXECUTE with a prepared plan and NULL

2009-01-04 Thread sergey kapustin
Hello! I'm trying to run this code in one of my stored procedures s := 'execute prepared_plan( ' || id_engine || ',' || id_search || ',' || id_rsite || ')'; execute s; where "prepared_plan" is a statement defined before with PREPARE. The thing is, that if i one of the parameters is NULL, then

Re: [SQL] EXECUTE query INTO problem

2008-11-25 Thread Pawel Socha
2008/11/25 Tk421 <[EMAIL PROTECTED]>: > I've got a problem with a function: It receives two parameters, the first, > the table name, and the second, a where condition. The function looks like > this: > > DECLARE > cod bigint; > query TEXT; > > BEGIN > query = 'SELECT codigo FRO

Re: [SQL] EXECUTE query INTO problem

2008-11-25 Thread Andreas Kretschmer
Tk421 <[EMAIL PROTECTED]> schrieb: >I've got a problem with a function: It receives two parameters, the > first, the table name, and the second, a where condition. The function > looks like this: > >DECLARE > cod bigint; > query TEXT; > >BEGIN > query = 'SELECT co

[SQL] EXECUTE query INTO problem

2008-11-25 Thread Tk421
I've got a problem with a function: It receives two parameters, the first, the table name, and the second, a where condition. The function looks like this: DECLARE cod bigint; query TEXT; BEGIN query = 'SELECT codigo FROM ' || $1 || ' WHERE ' || $2; EXECUTE qu

Re: [SQL] execute plpgsl like "normal" sql

2008-05-09 Thread Christian Kindler
Thanks! Chris Original-Nachricht > Datum: Fri, 9 May 2008 23:14:44 +1000 > Von: imad <[EMAIL PROTECTED]> > An: "Christian Kindler" <[EMAIL PROTECTED]> > Betreff: Re: [SQL] execute plpgsl like "normal" sql > Anonymous blocks are n

[SQL] execute plpgsl like "normal" sql

2008-05-09 Thread Christian Kindler
Hi Is there a possibility to execute pl/pgsql syntax like normal sql simmilar to sql+ from oracle? The question is: if I want to execute soemthing like this: --File foo.sql: begin for id in select id from mytable loop update myothertable set payed = true where fk_id = id; end loop; end; Do

Re: [SQL] execute system command from storage procedure

2007-12-06 Thread Andreas Kretschmer
Sabin Coanda <[EMAIL PROTECTED]> schrieb: > Hi there, > > Is it possible to execute a system command from a function ? (e.g. bash ) Yes, of course, but you need an untrusted language like pl/perlU oder plsh. http://plsh.projects.postgresql.org/ Andreas -- Really, I'm not out to destroy Micros

Re: [SQL] execute system command from storage procedure

2007-12-06 Thread Erik Jones
On Dec 6, 2007, at 10:32 AM, Sabin Coanda wrote: Hi there, Is it possible to execute a system command from a function ? (e.g. bash ) If you use one of the untrusted procedural languages (e.g. plperlu, plpythonu, ...) you can. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800

[SQL] execute system command from storage procedure

2007-12-06 Thread Sabin Coanda
Hi there, Is it possible to execute a system command from a function ? (e.g. bash ) TIA, Sabin ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] EXECUTE 'EXECUTE ...' or how to use dynamic prepared statements ?

2007-09-05 Thread Marc Mamin
Hello Dirk, I have to disagree. Your first update query is very low. It probably implies to run the sub select statement for each row to be updated. Following update statement is already much faster: (using UPDATE FROM) update test_table set mygroup= t.mygroup from test_table as t

Re: [SQL] EXECUTE 'EXECUTE ...' or how to use dynamic prepared statements ?

2007-09-04 Thread Dirk Jagdmann
Hello Marc, at first I tried to solve your update of the tables. The example you gave should be done with an update statement like the following: update test_table set mygroup=(select t.mygroup from test_table as t where t.family = test_table.family

[SQL] EXECUTE 'EXECUTE ...' or how to use dynamic prepared statements ?

2007-09-04 Thread Marc Mamin
Hello, I have a large upddate to perform on tables which are dynamically generated (dynamic names). In this simplified example, the operation should replace in each family the "mygroup" of each item of rang=0 with the "mygroup" value of the element of rang=1 : (the * indicate the modified valu

Re: [SQL] Execute SQL statements with 'context'/predefined variables

2007-09-03 Thread chester c young
... > When you say use rules to inject constants, how would I go about > doing this? Could you maybe give a brief example? create view tab1_dml as select * from tab1; -- note: -- CONSTANT1 = 8 -- CONSTANT2 = 15 create or replace rule tab1_insert as on insert to tab1_dml do instead( ins

Re: [SQL] Execute SQL statements with 'context'/predefined variables

2007-09-03 Thread chester c young
> I was wondering if it is possible to set the 'context' for running an > sql command Oracle has a Context('varname') that returns the value of varname for the session. to best of my knowledge pg has nothing like this. > I guess bottom line, is it possible to execute a bunch of SQL > statements

[SQL] Execute SQL statements with 'context'/predefined variables

2007-09-03 Thread blay bloo
I was wondering if it is possible to set the 'context' for running an sql command: For example, say you have a rule which upon update to table TEST of type [a int, b varchar(10), c varchar(50)]: INSERT INTO Log(a * 5, substring(b,0,2), randomize(c)) So an update of (5, 'hello', 'world') will add

[SQL] EXECUTE in a funtion to return a VIEW object ID

2007-04-10 Thread Wilkinson, Jim
Hi there, I have tried many ideas to get this working but no luck. Can some show me or explain what is happening EXAMPLE == I am trying to read to 2 text fields to combine them togther to form the name of a VIEW. example SELECT * FROM ( 'april'||'may') ; I have tried the EXECUTE i

Re: [SQL] EXECUTE with SELECT INTO variable, or alternatives

2005-09-30 Thread Michael Fuhr
On Fri, Sep 30, 2005 at 03:59:06PM -0500, Thomas F. O'Connell wrote: > Per the docs: > > "The results from SELECT commands are discarded by EXECUTE, and > SELECT INTO is not currently supported within EXECUTE. So there is no > way to extract a result from a dynamically-created SELECT using the

Re: [SQL] EXECUTE with SELECT INTO variable, or alternatives

2005-09-30 Thread Thomas F. O'Connell
Per the docs: "The results from SELECT commands are discarded by EXECUTE, and SELECT INTO is not currently supported within EXECUTE. So there is no way to extract a result from a dynamically-created SELECT using the plain EXECUTE command. There are two other ways to do it, however: one is

Re: [SQL] EXECUTE SELECT INTO... last one!

2005-09-30 Thread Mario Splivalo
On Fri, 2005-09-30 at 02:34 -0600, Michael Fuhr wrote: > On Fri, Sep 30, 2005 at 10:00:35AM +0200, Mario Splivalo wrote: > > PgSql8.1beta2 gives me this: > > > > ERROR: EXECUTE of SELECT ... INTO is not implemented yet > > CONTEXT: PL/pgSQL function "_rndbroj" line 5 at execute statement > > Co

Re: [SQL] EXECUTE SELECT INTO... last one!

2005-09-30 Thread Michael Fuhr
On Fri, Sep 30, 2005 at 10:00:35AM +0200, Mario Splivalo wrote: > PgSql8.1beta2 gives me this: > > ERROR: EXECUTE of SELECT ... INTO is not implemented yet > CONTEXT: PL/pgSQL function "_rndbroj" line 5 at execute statement Could you post a simple example of what you're trying to do? The follo

[SQL] EXECUTE SELECT INTO... last one!

2005-09-30 Thread Mario Splivalo
PgSql8.1beta2 gives me this: ERROR: EXECUTE of SELECT ... INTO is not implemented yet CONTEXT: PL/pgSQL function "_rndbroj" line 5 at execute statement Shall I forget about this once and for all (and use FOR construct), or there is a chance that will be 'fixed'? Mario -- Mario Splival

[SQL] EXECUTE with SELECT INTO variable, or alternatives

2005-09-29 Thread Mario Splivalo
I can assign a value to a variable in several ways: myVar := (SELECT col FROM table WHERE somecondition...) myVar := col FROM table WHERE somecondtition... SELECT col INTO myVar FROM table WHERE somecondition How do I do any of the above using EXECUTE? I need to be able to assign the value to a v

[SQL] Execute Query in Postgres Function

2004-02-29 Thread Sumita Biswas (sbiswas)
How do we execute a Query String in Postgresql function? Or what is the equivalent of the following Code in MSSQL Stored Procedure: SET @QueryToPopulateTemp = "INSERT INTO #Tmp_ConferenceDetail(ConferenceType, ConnectTime, DisconnectTime,DestConversationId, Duration, AppConfId, OrigDevice

Re: [SQL] Execute permissions for stored functions

2004-01-18 Thread Tom Lane
Paul Hart <[EMAIL PROTECTED]> writes: > In RDBMSs such as Oracle, stored PL/SQL functions run with the > permissions of the user that creates the function. Users who are given > EXECUTE privileges then call the function with the permissions of the > creator of the function. Use "SECURITY DEFINE

[SQL] Execute permissions for stored functions

2004-01-18 Thread Paul Hart
Hi all, From what I've seen in the archives, questions like this have kind of been answered in the past, but I was wondering if there have been any changes in this area, or if anyone has good ideas on how to do what I'm about to ask :) In RDBMSs such as Oracle, stored PL/SQL functions run with

[SQL] EXECUTE problem on schema

2003-03-26 Thread jack
Hi, all postgreSQL v7.3.3 I found EXECUTE on pl/pgsql doesn't support schema. When I specify a table such as "public.tablename", it reported "not such a relation object". The only SQL statement I used is "update". Don't know wether other statements have the same problem. Jack -

Re: [SQL] execute a query in an other db

2002-11-16 Thread Joe Conway
LR wrote: Thank you for your answer. Do you know the name of this package ? Thx Lilian see contrib/dblink. I'd highly recommend using 7.3 (finishing beta, soon to be a release candidate) if you can. It is much better than the one in 7.2 and the syntax has changed some. Joe ---

Re: [SQL] execute a query in an other db

2002-11-16 Thread LR
> > Hi, > > > > When I'm connected to a postgreSQL db ( e.g. myDB ), how could I execute > > "select * from myTable;" in an other db (e.g. myOtherDB). > > > > In other words, what is the postgreSQL equivalent of the MS SQL Server > > statement "USE myOtherDB SELECT * FROM myTable" ? > > Stock postg

Re: [SQL] execute a query in an other db

2002-11-12 Thread Bruno Wolff III
On Sat, Nov 09, 2002 at 17:51:40 +0100, LR <[EMAIL PROTECTED]> wrote: > Hi, > > When I'm connected to a postgreSQL db ( e.g. myDB ), how could I execute > "select * from myTable;" in an other db (e.g. myOtherDB). > > In other words, what is the postgreSQL equivalent of the MS SQL Server > state

[SQL] execute a query in an other db

2002-11-12 Thread LR
Hi, When I'm connected to a postgreSQL db ( e.g. myDB ), how could I execute "select * from myTable;" in an other db (e.g. myOtherDB). In other words, what is the postgreSQL equivalent of the MS SQL Server statement "USE myOtherDB SELECT * FROM myTable" ? Thanks Lilian ---

Re: [SQL] EXECUTE ... INTO?

2001-10-16 Thread Oliver Elphick
"Josh Berkus" wrote: >Folks, > >Can anybody tell me the syntax for sending the result of an EXECUTE to a >variable within a PL/pgSQL function again? Jan Wieck posted it to the >list this summer, but the "searchable list archives" are bogging down. FOR variable IN EXECUTE ''SELECT ...''

[SQL] EXECUTE ... INTO?

2001-10-15 Thread Josh Berkus
Folks, Can anybody tell me the syntax for sending the result of an EXECUTE to a variable within a PL/pgSQL function again? Jan Wieck posted it to the list this summer, but the "searchable list archives" are bogging down. -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] Execute permsissions on fuctions

2001-08-25 Thread Christopher Sawtell
On Sat, 25 Aug 2001 16:42, Zot O'Connor wrote: > Christopher Sawtell wrote: > > On Fri, 24 Aug 2001 06:52, Zot O'Connor wrote: > > > Other SQL servers have the concept of stored procedures having > > > different permissions. > > > > > > For instance a procedure that can update a table. > > > > > >

Re: [SQL] Execute permsissions on fuctions

2001-08-24 Thread Dmitry G. Mastrukov
23 Aug 2001 11:52:25 -0700, Zot O'Connor > Other SQL servers have the concept of stored procedures having different > permissions. > > For instance a procedure that can update a table. > > Since a web site typically connects as the webuser (or equiv postgres > user), I do not want to offer

Re: [SQL] Execute permsissions on fuctions

2001-08-24 Thread Zot O'Connor
Christopher Sawtell wrote: > > On Fri, 24 Aug 2001 06:52, Zot O'Connor wrote: > > Other SQL servers have the concept of stored procedures having different > > permissions. > > > > For instance a procedure that can update a table. > > > > Since a web site typically connects as the webuser (or equi

[SQL] Execute permsissions on fuctions

2001-08-23 Thread Zot O'Connor
Other SQL servers have the concept of stored procedures having different permissions. For instance a procedure that can update a table. Since a web site typically connects as the webuser (or equiv postgres user), I do not want to offer update to the webuser. The way I have done this elsewhere i

Re: [SQL] execute client application from PL/pgSql

2001-05-15 Thread Justin Clift
12 May 2001, datactrl wrote: > > > Date: Sat, 12 May 2001 10:23:39 +1000 > > From: datactrl <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Subject: Re: [SQL] execute client application from PL/pgSql > > > > Thank You Jeff, > > What is phpPgAdmin

Re: [SQL] execute client application from PL/pgSql

2001-05-14 Thread Jeff MacDonald
CTED] > Subject: Re: [SQL] execute client application from PL/pgSql > > Thank You Jeff, > What is phpPgAdmin and where can get it? > > Jack > > - Original Message - > From: "Jeff MacDonald" <[EMAIL PROTECTED]> > To: "Jack" <[EMAIL

Re: [SQL] execute client application from PL/pgSql

2001-05-11 Thread datactrl
Thank You Jeff, What is phpPgAdmin and where can get it? Jack - Original Message - From: "Jeff MacDonald" <[EMAIL PROTECTED]> To: "Jack" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, May 12, 2001 2:28 AM Subject: Re: [SQL] execute cl

Re: [SQL] execute client application from PL/pgSql

2001-05-11 Thread clayton cottingham
Jack wrote: > > Is that possible to execute a client application from server site by > PL/Pgsql, such as pg_dump? Because my client sites are running Windows OS, > or is there any Windows version of all Client Applications come from > PostGreSQL V7.1? > > Jack > > ---(e

Re: [SQL] execute client application from PL/pgSql

2001-05-11 Thread Jeff MacDonald
you could hack the pg_dump bit out of phpPgAdmin i think the license permits it. just my 2 cents. jeff On Wed, 9 May 2001, Jack wrote: > Date: Wed, 9 May 2001 09:45:46 +1000 > From: Jack <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: [SQL] execute client applica

[SQL] execute client application from PL/pgSql

2001-05-11 Thread Jack
Is that possible to execute a client application from server site by PL/Pgsql, such as pg_dump? Because my client sites are running Windows OS, or is there any Windows version of all Client Applications come from PostGreSQL V7.1? Jack ---(end of broadcast)-