Re: [SQL] Requests for Development

2000-11-10 Thread Gerhard Dieringer

>>> Josh Berkus <[EMAIL PROTECTED]> 09.11.2000  17.40 Uhr >>>
> Tom, Bruce, Jan, etc.:
>
>   As a PGSQL developer and business customer, I wanted to make some
> public requests as to the development path of PGSQL.  While, obviously,
> you will develop the functionality *you* are interested in, I thought it
> might be valuable to you to know what things would be most appreciated
> (and please, list folks, speak up).

I'm still dreaming of 'database links', or how ever you want to call the possibility 
to access 
tables/views in different dbs, maybe on different hosts, in one sql statement.


>   Thanks so much for your ongoing hard work!

ditto


-
Gerhard




[SQL] Return from stored procedures

2000-11-10 Thread Graham Vickrage

Probably a very simple question, but how do you define a function that
returns the sucess of an insert or update in a function i.e.

CREATE FUNCTION foo ( varchar, int8 ) RETURNS bool
AS 'UPDATE table WHERE something'
LANGUAGE 'sql';

Cheers

Graham




Re: [SQL] Re: Requests for Development

2000-11-10 Thread KuroiNeko

> I wonder if there couldn't borrowed some code from Interbase which has
> full featured stored procedures - at least  it was told to me that it has
> ...

 Well, I have some hands-on experience  with IB, don't know whether this is
perfectly relevant, but here goes
 Indeed, stored  procedures in  IB can do  what's called  `returning record
sets' in  this thread. This  is helpfull  when tuples restriction  is based
upon  condition  that is  not  easy/possible  to  formulate in  SQL  (where
clause).  On the  other hand,  IB has  two different  ways to  call an  SP:
execute  procedure  for `singleton'  SPs  and  select for  those  returning
multiple tuples.
 However, IB supports  only its own SP language. It's  pretty much complete
and well thought and implemented, but if you want an SP in PERL, you're out
of luck.
 What I'd really  like to see is  `pre-compiled' SPs in PGSQL.  IB has this
feature (SPs are converted to BLR when DDL statement is executed), not sure
about PGSQL.  I've noticed  that language-specific errors  in SPs  are only
reported by  PGSQL when SP is  executed, so I suggest  that interpreter (eg
for PL/PGSQL) is called each time.


--

 Sniper's rifle is an extension of his eye. He kills with his injurious vision.

 JM




Re: [SQL] Return from stored procedures

2000-11-10 Thread Kovacs Zoltan Sandor

> Probably a very simple question, but how do you define a function that
> returns the sucess of an insert or update in a function i.e.
> 
> CREATE FUNCTION foo ( varchar, int8 ) RETURNS bool
> AS 'UPDATE table WHERE something'
> LANGUAGE 'sql';
With SQL functions you can't (as far as I know). Try PLPGSQL ones instead,
you can use the keyword 'found'. See the documentation for details.

Zoltan 




[SQL] SELECT FROM t1 WHERE id IN (SELECT id FROM t2 UNION SELECT id FROM t3)

2000-11-10 Thread Christophe Boyanique

Hello,

I've got a problem with UNION and SELECT IN

I have a first table:

CREATE TABLE products
(
  idProduct   INT4,
  nameVARCHAR(32)
);

and two others tables:

CREATE TABLE orders
(
  id  INT4,
  ts  TIMESTAMP
);

CREATE TABLE preorders
(
  id  INT4,
  ts  TIMESTAMP
);

(I reduced the tables to be as simple as possible)

I want to retrieve id of products from the tables orders and preorders;
and order it by the name of the product. So I tried:

SELECT idProduct FROM products
  WHERE idProduct IN
(SELECT id FROM orders WHERE ts>'2000-10-01 17:04:00'
UNION SELECT id FROM preorders WHERE ts>'2000-10-01 17:04:00')
  ORDER by name;

and I've got a parse error near UNION or SELECT depending of the
presence
of () between the SELECTs.

I definitively need some help to solve this problem :-|

I asked to a friend to test it with Oracle and that seems to work so I
really don't know what to do...

Christophe.



Re: [SQL] SELECT FROM t1 WHERE id IN (SELECT id FROM t2 UNION SELECT id FROM t3)

2000-11-10 Thread Tom Lane

Christophe Boyanique <[EMAIL PROTECTED]> writes:
> SELECT idProduct FROM products
>   WHERE idProduct IN
> (SELECT id FROM orders WHERE ts>'2000-10-01 17:04:00'
> UNION SELECT id FROM preorders WHERE ts>'2000-10-01 17:04:00')
>   ORDER by name;

> and I've got a parse error near UNION or SELECT depending of the

Current releases don't handle UNION in sub-selects.  7.1 will.

In the meantime, consider doing the UNION into a temp table and then
using that for the IN operator.

regards, tom lane



Re: [SQL] SELECT FROM t1 WHERE id IN (SELECT id FROM t2 UNION SELECT id FROM t3)

2000-11-10 Thread Christophe Boyanique

Tom Lane wrote :

> Current releases don't handle UNION in sub-selects.  7.1 will.
Thanks very much for this "fast as speed light" answer !

Is there an idea about the 7.1 release date ? Just to know if this is
will be in weeks, months or years...

Christophe.



Re: [SQL] SELECT FROM t1 WHERE id IN (SELECT id FROM t2 UNION SELECT id FROM t3)

2000-11-10 Thread Tomas Berndtsson

Tom Lane <[EMAIL PROTECTED]> writes:

> Christophe Boyanique <[EMAIL PROTECTED]> writes:
> > SELECT idProduct FROM products
> >   WHERE idProduct IN
> > (SELECT id FROM orders WHERE ts>'2000-10-01 17:04:00'
> > UNION SELECT id FROM preorders WHERE ts>'2000-10-01 17:04:00')
> >   ORDER by name;
> 
> > and I've got a parse error near UNION or SELECT depending of the
> 
> Current releases don't handle UNION in sub-selects.  7.1 will.
> 
> In the meantime, consider doing the UNION into a temp table and then
> using that for the IN operator.

Is it possible to create a view with UNION and use that in the
sub-select?


Tomas



[SQL] special caracters!

2000-11-10 Thread rocael

Hi!
When I store special caracters from spanish language I have problems when I
got it back because it do not return what I have stored.

Is some available support for that in postgres 7.0.2?

thank you,
Rocael.



Get free email and a permanent address at http://www.netaddress.com/?N=1