Re: [SQL] CREATE SEQUENCE fails in plpgsql function

2003-06-30 Thread Stephan Szabo
On Mon, 30 Jun 2003, Erik Erkelens wrote: > new_max_records ALIAS FOR $1; > BEGIN > DROP SEQUENCE my_sequence; > --CREATE SEQUENCE my_sequence MAXVALUE 4 > CYCLE; > CREATE SEQUENCE my_sequence MAXVALUE > new_max_records CYCLE; Most of the creates/drops/etc...

Re: [SQL] LEAST and GREATEST functions?

2003-06-30 Thread Josh Berkus
Stefan, > I know the LEAST and GREATEST functions are not part > of standard SQL, but they sure were handy where I came > from (Oracle-land). > > Has anyone written user-defined functions that do the > same thing? > > Are there any plans to add these functions as part of > a future version Postgre

[SQL] LEAST and GREATEST functions?

2003-06-30 Thread Stefan Bill
Hi, I know the LEAST and GREATEST functions are not part of standard SQL, but they sure were handy where I came from (Oracle-land). Has anyone written user-defined functions that do the same thing? Are there any plans to add these functions as part of a future version Postgres? Thanks, -Stefan

[SQL] CREATE SEQUENCE fails in plpgsql function

2003-06-30 Thread Erik Erkelens
Hi, I need a table to hold the last n INSERTs into it. To keep track of how many entries there are, and to provide a unique id to order the records in the table, I use a sequence. A trigger function deletes and entry on an insert if the table is full. The number n maybe changed, so I implemen

Re: [SQL] Need help creating a BEFORE DELETE trigger

2003-06-30 Thread Rod Taylor
> The problem I'm looking at is: could this cause a recursion problem, where the > cascading deletion will try to cause the whole thing to cascade again? How It will only be able to delete the row (and cascade) once per row. The second time it tries to find the row, the row won't exist anymore.

Re: [SQL] cleaning up useless pl/pgsql functions

2003-06-30 Thread Rod Taylor
On Mon, 2003-06-30 at 21:13, Tomasz Myrta wrote: > Hi > Do you have any easy script to remove all pl/pgsql function? After a lot of > changes inside "create or replace function..." scripts I have a big mess. I > want to remove all user defined pl/pgsql functions and restore some of them > from m

Re: [SQL] help with "delete joins"

2003-06-30 Thread Josh Berkus
Robert, > delete * from foo where not (foo.a = bar.a and foo.b=bar.b and > foo.c=bar.c) ; > > so i end up with > > postgres=# select * from foo; > a | b | c | d > ---+---+---+--- > 1 | 2 | 4 | A > 4 | 5 | 6 | b > (2 rows) > > but thats not valid sql, is there some way to accomplish this?

Re: [SQL] Bitwise operation

2003-06-30 Thread Rudi Starcevic
Bruno,Hubert, Thanks. It's all crystal clear now. Now I can keep moving on with my app. If all goes well I hope to add a 'techdoc' on how to do this. I've found documents from other DBMS on using Bitwise operations but not PG. Cheers Rudi. Bruno Wolff III wrote: On Mon, Jun 30, 2003 at

Re: [SQL] cleaning up useless pl/pgsql functions

2003-06-30 Thread Mendola Gaetano
"Tomasz Myrta" <[EMAIL PROTECTED]> wrote: > Hi > Do you have any easy script to remove all pl/pgsql function? After a lot of > changes inside "create or replace function..." scripts I have a big mess. I > want to remove all user defined pl/pgsql functions and restore some of them > from my scripts

Re: [SQL] help with "delete joins"

2003-06-30 Thread Robert Treat
On Mon, 2003-06-30 at 18:26, Robert Treat wrote: > create table foo (a int, b int, c int, d text); > > create table bar (a int, b int, c int); > > insert into foo values (1,2,3,'a'); > insert into foo values (1,2,4,'A'); > insert into foo values (4,5,6,'b'); > insert into foo values (7,8,9,'c');

Re: [SQL] help with "delete joins"

2003-06-30 Thread Stephan Szabo
On 30 Jun 2003, Robert Treat wrote: > create table foo (a int, b int, c int, d text); > > create table bar (a int, b int, c int); > > insert into foo values (1,2,3,'a'); > insert into foo values (1,2,4,'A'); > insert into foo values (4,5,6,'b'); > insert into foo values (7,8,9,'c'); > insert into

[SQL] help with "delete joins"

2003-06-30 Thread Robert Treat
create table foo (a int, b int, c int, d text); create table bar (a int, b int, c int); insert into foo values (1,2,3,'a'); insert into foo values (1,2,4,'A'); insert into foo values (4,5,6,'b'); insert into foo values (7,8,9,'c'); insert into foo values (10,11,12,'d'); insert into bar values (1

Re: [SQL] cleaning up useless pl/pgsql functions

2003-06-30 Thread Josh Berkus
Tomasz, > Hmm Answer to myself: > > DELETE from pg_proc where prolang =(select oid from pg_language where > lanname='plpgsq'); > > What do you think about it? You probably also want to put a "proowner = {your userid}" condition in there, just in case there are any builtins/contrib stuff that

[SQL] Need help creating a BEFORE DELETE trigger

2003-06-30 Thread Michael A Nachbaur
Hello everyone, I'm creating two database tables that will be used to cache the results of a search. Basically, when a search is initiated, an entry will be created in the "Search" table that represents the search, and a single entry will be created in a child table "SearchResults" for every r

Re: [SQL] cleaning up useless pl/pgsql functions

2003-06-30 Thread Tomasz Myrta
Dnia 2003-06-30 23:13, Użytkownik Tomasz Myrta napisał: Hi Do you have any easy script to remove all pl/pgsql function? After a lot of changes inside "create or replace function..." scripts I have a big mess. I want to remove all user defined pl/pgsql functions and restore some of them from my s

[SQL] cleaning up useless pl/pgsql functions

2003-06-30 Thread Tomasz Myrta
Hi Do you have any easy script to remove all pl/pgsql function? After a lot of changes inside "create or replace function..." scripts I have a big mess. I want to remove all user defined pl/pgsql functions and restore some of them from my scripts again. Regards, Tomasz Myrta ---

Re: [SQL] need some help with a delete statement

2003-06-30 Thread scott.marlowe
On Mon, 30 Jun 2003, Matthew Hixson wrote: > On Monday, June 30, 2003, at 05:06 AM, scott.marlowe wrote: > > > On Fri, 27 Jun 2003, Matthew Hixson wrote: > > > >> Hi, I have a bunch of records that I need to delete from our database. > >> These records represent shopping carts for visitors to our

Re: [SQL] need some help with a delete statement

2003-06-30 Thread Matthew Hixson
On Monday, June 30, 2003, at 05:06 AM, scott.marlowe wrote: On Fri, 27 Jun 2003, Matthew Hixson wrote: Hi, I have a bunch of records that I need to delete from our database. These records represent shopping carts for visitors to our website. The shopping carts I'd like to delete are the ones with

Re: [SQL] ERROR: ExecEvalExpr: unknown expression type 108

2003-06-30 Thread Tom Lane
Rod Taylor <[EMAIL PROTECTED]> writes: > SubSelects have undergone a large simplification by Tom while > implementing read-only plans in the executor. This seems to have > accidentally fixed this case. Nothing accidental about it. http://archives.postgresql.org/pgsql-general/2002-12/msg00375.php

Re: [SQL] ERROR: ExecEvalExpr: unknown expression type 108

2003-06-30 Thread Tom Lane
Markus Bertheau <[EMAIL PROTECTED]> writes: > PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 > datetest=# select * from (select (select count(1) from (select von from > daten union select bis as von from daten) as d1 where d1.von < d2.von) > as number, von from (select von f

Re: [SQL] ERROR: ExecEvalExpr: unknown expression type 108

2003-06-30 Thread Rod Taylor
> datetest=# select * from (select (select count(1) from (select von from > daten union select bis as von from daten) as d1 where d1.von < d2.von) > as number, von from (select von from daten union select bis as von from > daten) d2) as table1 join (select (select count(1) + 1 from (select von > f

[SQL] ERROR: ExecEvalExpr: unknown expression type 108

2003-06-30 Thread Markus Bertheau
Hi, datetest=# select version(); version -- PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 (1 запись) datetest=# \d daten

Re: [SQL] Seqno. is not btree?

2003-06-30 Thread Tom Lane
"Anagha Joshi" <[EMAIL PROTECTED]> writes: > After as many as 2412081 records are inserted, I shutdown my server. > Next day,I tried the following: > test=3D# select count(*) from vchar; > count > --- > 2568 > (1 row) > test=3D# insert into vchar (col_var) values ('VV'); > ERROR: Index vc

Re: [SQL] select column from table

2003-06-30 Thread scott.marlowe
On Mon, 30 Jun 2003, Abdul Wahab Dahalan wrote: > Hi everybody! > > I just want to know is there a way in SQL command that can handle column > selection?. > The case is : > If I've a table with 10 columns and I want to select 8 of them without > rewrite the columns/fields name in the SQL query?

Re: [SQL] Bitwise operation

2003-06-30 Thread Bruno Wolff III
On Mon, Jun 30, 2003 at 22:28:15 +1000, Rudi Starcevic <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm learning to use Postgresql's bitwise operator's as I'm interested > in building super fast search's based on user selections in web forms. > > So far so good but I have just lost it a little so I

Re: [SQL] Bitwise operation

2003-06-30 Thread Hubert Lubaczewski
On Mon, 30 Jun 2003 22:28:15 +1000 "Rudi Starcevic" <[EMAIL PROTECTED]> wrote: > SELECT & 111 = 71 > I was expecting the second example to be > SELECT & 111 = 111 hmm ..: let's see: dec() is bin(10001010111) dec(111) is bin(110) so, when we'll "AND" them: : 10001010

Re: [SQL] need some help with a delete statement

2003-06-30 Thread scott.marlowe
On Fri, 27 Jun 2003, Matthew Hixson wrote: > Hi, I have a bunch of records that I need to delete from our database. > These records represent shopping carts for visitors to our website. > The shopping carts I'd like to delete are the ones without anything in > them. Here is the schema: > >

[SQL] Bitwise operation

2003-06-30 Thread Rudi Starcevic
Hi, I'm learning to use Postgresql's bitwise operator's as I'm interested in building super fast search's based on user selections in web forms. So far so good but I have just lost it a little so I thought I'd post. Please growl at me if I'm asking on the wrong list :-) I understand this: SELE

[SQL] Seqno. is not btree?

2003-06-30 Thread Anagha Joshi
Title: Seqno. is not btree? Hi, I use Postgresql-7.2.4 I’ve created following table: create table vchar (     seqno SERIAL,     col_var character varying (8192)     ); After as many as 2412081 records are inserted,  I shutdown my server.  My every record was inserted programatically by

[SQL] select column from table

2003-06-30 Thread Abdul Wahab Dahalan
Hi everybody! I just want to know is there a way in SQL command that can handle column selection?. The case is : If I've a table with 10 columns and I want to select 8 of them without rewrite the columns/fields name in the SQL query? eg : Current SQL query is :- Select a,b,c,d,e,f,g,h from abcta

Re: [SQL] Postgres - Delphi Application

2003-06-30 Thread Tomasz Myrta
Dnia 2003-06-27 16:07, Użytkownik Együd Csaba napisał: Tomasz, it seems to be interesting for me as well, but actually I can't download a file from the given url. I just click on the binary zip link, but nothing happen. How should I click? :) Thanks, There is nothing special - it's a default source