Added.
---
Josh Berkus wrote:
> Bruce,
>
> > OK, so what should the TODO item be?
>
> Go with the simple and intuitive:
>
> EXECUTE query_var INTO record_var;
>
> --
> -Josh Berkus
> Aglio Database Solutions
> San Fra
Bruce,
> OK, so what should the TODO item be?
Go with the simple and intuitive:
EXECUTE query_var INTO record_var;
--
-Josh Berkus
Aglio Database Solutions
San Francisco
---(end of broadcast)---
TIP 9: the planner will ignore your desire to c
OK, so what should the TODO item be?
---
Josh Berkus wrote:
> Guys,
>
> > I'm not an Oracle bunny but they seem to have something vaguely similar
> > to what we do; they call it "EXECUTE IMMEDIATE" and the concept is
> > de
Guys,
> I'm not an Oracle bunny but they seem to have something vaguely similar
> to what we do; they call it "EXECUTE IMMEDIATE" and the concept is
> described as "Dynamic SQL".
Aha. I see it now; a pretty awful OO-package-style format. I don't think we
want to imitate this.
--
-Josh Berku
On Fri, Aug 01, 2003 at 01:06:18PM -0700, Josh Berkus wrote:
> As far as I can tell from my PL/SQL guide to Oracle8, PL/SQL does not permit
> exectution of strings-as-queries at all. So there's no equivalent in PL/SQL.
I'm not an Oracle bunny but they seem to have something vaguely similar
to w
Robert,
> I don't seem to have any plsql specfic documentation, and the rest of my
> oracle documentation isn't specfific enough. Anyone else?
As far as I can tell from my PL/SQL guide to Oracle8, PL/SQL does not permit
exectution of strings-as-queries at all. So there's no equivalent in PL/SQ
I don't seem to have any plsql specfic documentation, and the rest of my
oracle documentation isn't specfific enough. Anyone else?
Robert Treat
On Thursday 31 July 2003 00:12, Bruce Momjian wrote:
> Does Oracle have a syntax for this?
>
> -
Does Oracle have a syntax for this?
---
Robert Treat wrote:
> On Wednesday 23 July 2003 19:06, Bruce Momjian wrote:
> > Robert Treat wrote:
> > > On Wed, 2003-07-23 at 15:38, [EMAIL PROTECTED] wrote:
> > > > FOR myrec IN E
Bruce--
Something for the todo list. This would be extremely
handy. At minimum C functions should be able to
ask the type of thing that was actually passed in and get
a legitimate answer even if the type were a
rowtype.
This will also lead to the need for unnamed rowtypes,
sooner or later.
I k
elein <[EMAIL PROTECTED]> writes:
> So, other than C, plperl or pltcl is the way to go.
> As long as they can input generic composite types
> (I wasn't sure of that, but I should have known),
Come to think of it, that is a problem: we don't have any way to declare
a function as taking "any tuple
On Wednesday 23 July 2003 19:06, Bruce Momjian wrote:
> Robert Treat wrote:
> > On Wed, 2003-07-23 at 15:38, [EMAIL PROTECTED] wrote:
> > > FOR myrec IN EXECUTE myinfo LOOP
> > > biglist := myrec.info;
> > > END LOOP;
> >
> > One other thing, I hate when I have to do things like the above,
Robert Treat wrote:
> On Wed, 2003-07-23 at 15:38, [EMAIL PROTECTED] wrote:
> > FOR myrec IN EXECUTE myinfo LOOP
> > biglist := myrec.info;
> > END LOOP;
> >
>
> One other thing, I hate when I have to do things like the above, can we
> get a TODO like:
>
> allow 'EXECUTE var INTO record'
On Wed, 2003-07-23 at 15:38, [EMAIL PROTECTED] wrote:
> FOR myrec IN EXECUTE myinfo LOOP
> biglist := myrec.info;
> END LOOP;
>
One other thing, I hate when I have to do things like the above, can we
get a TODO like:
allow 'EXECUTE var INTO record' in plpgsql
Robert Treat
--
Build A Br
Robert,
> 2) would it be faster in pltcl? seems like it would if i didn't have to
> do the catalog lookups, but is pltcl inherently faster anyways?
Probably, yes. Execution of dynamic query strings in PL/pgSQL tends to be
pretty slow.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
Questions for the group:
1) any way to do this without the ctid/oid? Sounds like I could do
select a,b,msgmaker(*) from t1 where a=b; in pltcl (which was an early
inclination I abandoned, perhaps prematurely)
2) would it be faster in pltcl? seems like it would if i didn't have to
do the catalog l
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Perhaps something like this?. Called like thus:
SELECT a,b,c,msgmaker('t1',ctid) FROM t1 WHERE a=b;
CREATE OR REPLACE FUNCTION msgmaker(text,tid) RETURNS text AS '
DECLARE
mytable ALIAS FOR $1;
mytid ALIAS FOR $2;
myctid TEXT;
myque
So, other than C, plperl or pltcl is the way to go.
As long as they can input generic composite types
(I wasn't sure of that, but I should have known),
they can access columns as array elements so you can
loop through them. And they'll tell you the number
of arguments. Ta da!
elein
On Wed, Jul 2
elein <[EMAIL PROTECTED]> writes:
> You can do it in C, of course.
Yeah. Also you could do it easily in plperl or pltcl (composite-type
arguments get passed as perl hashes or Tcl arrays respectively).
plpgsql does not have any facility for run-time determination of field
names, so you're pretty m
Elein, Robert,
I think Robert can do this in 7.3.3, and in PL/pgSQL. But I'm not going any
further on it until Robert clarifies his examples, because I'm not sure what
he's talking about.
In your example, Robert, you use "f1" to indicate both the column f1 and the
value of the column f1.
How will you know in your function what the field
names are (you won't) and how many fields to concat
unless the function would only work on a fixed number
of fields?
If it only works on a fixed number of fields,
you still have:
myconcat( text, text, text, text )
called by
sele
On Wed, 2003-07-23 at 09:06, Robert Treat wrote:
> On Tue, 2003-07-22 at 19:33, elein wrote:
> > You'll need to pass the values down to your
> > concat function (which I suggest you don't call concat)
> > and have it return a text type.
> >
> > What exactly is your problem? I must be missing some
On Tue, 2003-07-22 at 19:33, elein wrote:
> You'll need to pass the values down to your
> concat function (which I suggest you don't call concat)
> and have it return a text type.
>
> What exactly is your problem? I must be missing something.
>
The problem is that I need the function to be gene
Robert,
> I'm starting to believe this is not possible, has anyone already done
> it? :-)
It sounds doable but you need more explicit examples; I can't quite tell what
you're trying to do.
--
Josh Berkus
Aglio Database Solutions
San Francisco
---(end of broadcast)---
You'll need to pass the values down to your
concat function (which I suggest you don't call concat)
and have it return a text type.
What exactly is your problem? I must be missing something.
elein
On Tue, Jul 22, 2003 at 06:31:52PM -0400, Robert Treat wrote:
> given
>
> create table t1 (f,f1,
given
create table t1 (f,f1,f2,f3);
create table t2 (f,f4,f5,f6);
i'm trying to create a function concat() that does something like:
select f,concat() as info from t1;
which returns a result set equivalent to:
select f,('f1:' || f1 || '- f2:' || f2 || '- f3:' || f3) as x from t1;
or
select f,
25 matches
Mail list logo