Re: [SQL] EXTERN JOIN with WHEN query

2003-06-08 Thread Mendola Gaetano
I didn't read all the entire problem but try to use WHERE instead of WHEN. Regards Gaetano Mendola - Original Message - From: "javier garcia - CEBAS" <[EMAIL PROTECTED]> To: "pgsql-sqL" <[EMAIL PROTECTED]> Sent: Thursday, June 05, 2003 12:55 PM Subject: [SQL] EXTERN JOIN with WHEN query

Re: [SQL] How to make a IN without a table... ?

2003-06-08 Thread Bruno Wolff III
On Wed, Jun 04, 2003 at 16:59:02 +0200, David Pradier <[EMAIL PROTECTED]> wrote: > > In short, i want to calculate the result of the function my_function for > some values of my_var1, cross by some values of my_var2. > These values are not taken in a table, but put in directly. > They are a lot,

Re: [SQL] "Join" on delimeter aggregate query

2003-06-08 Thread Bruno Wolff III
On Fri, Jun 06, 2003 at 10:03:29 -0700, Michael A Nachbaur <[EMAIL PROTECTED]> wrote: > > Postfix can deliver to multiple targets, if you separate the targets with > comas, like so: > > Source Target > [EMAIL PROTECTED] [EMAIL PROTECTED],[EMAIL PROTECTED], > > What I would l

Re: [SQL] Elegant SQL solution:

2003-06-08 Thread Ian Barwick
On Friday 06 June 2003 18:26, Chris Gamache wrote: > I could create a one-column table with values 1 - 12 in it, and select from > that table with a where clause matching "month". I could also create a view > "SELECT 1 UNION SELECT 2 UNION ..." and select against the view. There MUST > be a more e

Re: [SQL] Domains and Joins

2003-06-08 Thread Rod Taylor
On Thu, 2003-06-05 at 17:38, chester c young wrote: > -- standard setup: > create table t1( c1 int primary key, data text ); > create domain dom_c1 int references t1 on delete cascade; This won't work. Domains support NOT NULL, and CHECK constraints. Foreign keys are not allowed on domains at thi

Re: [SQL] (long) What's the problem?

2003-06-08 Thread Jan Wieck
David Olbersen wrote: Anybody have any ideas about a problem with this query? urldb2=> EXPLAIN urldb2-> SELECT urldb2-> id, urldb2-> source, urldb2-> insertedby, urldb2-> insertedon, urldb2-> priority urldb2-> FROM urldb2-> indexscan urldb2-> WHERE urldb2-> lower( urldb2-> substr

Re: [SQL] Using a RETURN NEXT

2003-06-08 Thread Joe Conway
Mr Weinbach, Larry wrote: But at execution time I am getting thi error : WARNING: Error occurred while executing PL/pgSQL function word_case WARNING: line 5 at return next ERROR: Set-valued function called in context that cannot accept a set You didn't show the execution time SQL statement, but

[SQL] Using a RETURN NEXT

2003-06-08 Thread Mr Weinbach, Larry
Hi all, I found this example from Postgres site create or replace function GetRows(text) returns setof record as ' declare r record; begin for r in EXECUTE ''select * from '' || $1 loop return next r; end loop; return; end ' language 'plpgsql'; I am trying to use the sam

Re: [SQL] "Join" on delimeter aggregate query

2003-06-08 Thread Eivind Kvedalen
Hi You can create an aggregate function to solve this. A friend of mine asked the same question a while ago, and I created a possible example solution for him, which I paste here: CREATE FUNCTION concat(varchar,varchar) RETURNS varchar AS 'SELECT CASE $1 WHEN \'\' THEN $2

Re: [SQL] (long) What's the problem?

2003-06-08 Thread Rod Taylor
> rposition() is a volatile custom C function. Does the query function as expected when not being EXPLAINed ? Odds are it's a bug in the custom C function. -- Rod Taylor <[EMAIL PROTECTED]> PGP Key: http://www.rbt.ca/rbtpub.asc signature.asc Description: This is a digitally signed message pa

[SQL] Creating Views with Column Names based on Distinct Row Data

2003-06-08 Thread Damien Dougan
Hi All, (I'm sure I'm not the first person to want to do this, but I didn't see any mention of it in the FAQ or developers FAQ nor in the docs - if I've missed something, a gentle pointer will be fine :) I was wondering if it is possible to create a table view based on a table which is effec

Re: [SQL] "Join" on delimeter aggregate query

2003-06-08 Thread Joe Conway
Michael A Nachbaur wrote: Source Target [EMAIL PROTECTED] [EMAIL PROTECTED],[EMAIL PROTECTED], It isn't clear from your description what you want (to me, anyway), but I'd guess something like this: regression=# select * from src2tgt; source| target -+

Re: [SQL] Changing owner of function -- best method?

2003-06-08 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: > A) Updating the pg_proc table to change the function owner; That seems safe enough. regards, tom lane ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL

Re: [SQL] Elegant SQL solution:

2003-06-08 Thread Josh Berkus
CGG: > I could create a one-column table with values 1 - 12 in it, and select from > that table with a where clause matching "month". This is probably the simplest, most elegant solution. It is also the "most relational". > I could also create a view > "SELECT 1 UNION SELECT 2 UNION ..." and

Re: [SQL] Elegant SQL solution:

2003-06-08 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > SELECT date_part('month',rowdate) as month, count(*) as rows FROM mytable GROUP > BY month; >... > I could create a one-column table with values 1 - 12 in it, and select from > that table with a where clause matching "month". I could also create a

Re: [SQL] Changing owner of function -- best method?

2003-06-08 Thread Dmitry Tkach
Josh Berkus wrote: Folks, I have several functions in a 7.2.4 database that I accidentally REPLACEd while logged in as the superuser, instead of the db owner. As a result, the db owner can no longer modify those functions -- they belong to the superuser. As this is a production database, I

[SQL] How to make a IN without a table... ?

2003-06-08 Thread David Pradier
Hi everybody, i ran today in a problem when doing some (too much for me) advanced sql... What i want to do is something like this: SELECT my_var1, my_var2, my_function(my_var1, my_var2) FROM ( SELECT '1', '2', '3',

[SQL] Change owner of function in 7.2.4?

2003-06-08 Thread Josh Berkus
Folks, I have a 7.2.4 database where I accidentally replaced a bunch of functions while logged in as the superuser. Now the normal applicaiton user can't modify them. While I can fix them by dropping the functions as the superuser and re-creating them as the regular user, I can't see how to