[SQL] Regexps -- too complex?

2001-04-26 Thread Emils Klotins
Running 7.0.2 on Alpha/RedHat 6.2 256MB RAM In order to implement a fulltext search, I have a func that parses list of words and creates a regexp query with things like [[::]]( word | word | ... )[[::]] That query then is passed to backend... Now the strange thing: gamenet=# SELECT id,

Re: [SQL] using top-level aggregate values in subqueries

2001-04-26 Thread Ossie J. H. Moore
Subject: Re: [SQL] using top-level aggregate values in subqueries Date: Mon, 23 Apr 2001 23:24:48 -0500 From: Ossie J. H. Moore [EMAIL PROTECTED] To: Thomas F. O'Connell [EMAIL PROTECTED] I'm a little unclear on what you are trying to do here so I'll take a stab at explaining how you can

[SQL] Re: Using Random Sequence as Key

2001-04-26 Thread Vasilis Samoladas
Hello Bernardo, there is a somewhat mathematical solution to your problem. You can use a unique key, say 0= k MAX for each record, and a second key which is computed from the first, say f(k), which will give you a unique permutation of the numbers 0,...,MAX-1. It will not be random, but it will

Re: [SQL] MySql 'REPLACE'

2001-04-26 Thread Thomas Swan
At 4/25/2001 07:38 AM, you wrote: I am working in porting the Slash software from MySql to PostgreSQL. I stepped in MySql's REPLACE command (a SQL command) that to my knowledge is not supported by PostgreSQL and it's not standard SQL. According to MySql's manual: REPLACE works exactly like

[SQL] problem with pl/pgsql

2001-04-26 Thread Mark Nielsen
hey guys, I am writing an article about using Perl inside sql commands. I am not having a problem with perl, but with pl/pgsql. The documentation for pl/pgsql isn't helping me out, although I am sure I will figure it out eventually. Here is the perl function, CREATE FUNCTION

Re: [SQL] SET SEQSCAN TO OFF - error

2001-04-26 Thread Peter Eisentraut
Hans-Jürgen Schönig writes: I have the command below like it is described in the documentation (http://www.archonet.com/pgdocs/force-index.html) but it doens't work. SET SEQSCAN TO OFF; ERROR: 'seqscan' is not a valid option name Does anybody know why? Because 'seqscan' is not a valid

Re: [SQL] SET SEQSCAN TO OFF - error

2001-04-26 Thread Jeff Hoffmann
Hans-Jürgen Schönig wrote: I have the command below like it is described in the documentation (http://www.archonet.com/pgdocs/force-index.html) but it doens't work. SET SEQSCAN TO OFF; ERROR: 'seqscan' is not a valid option name Does anybody know why? because the documentation is

Re: [SQL] SET SEQSCAN TO OFF - error

2001-04-26 Thread Bruce Momjian
I have the command below like it is described in the documentation (http://www.archonet.com/pgdocs/force-index.html) but it doens't work. SET SEQSCAN TO OFF; ERROR: 'seqscan' is not a valid option name Does anybody know why? Try: test= set enable_seqscan to off;

[SQL] SET SEQSCAN TO OFF - error

2001-04-26 Thread Hans-Jürgen Schönig
I have the command below like it is described in the documentation (http://www.archonet.com/pgdocs/force-index.html) but it doens't work. SET SEQSCAN TO OFF; ERROR: 'seqscan' is not a valid option name Does anybody know why? Hans ---(end of

Re: [SQL] Regexps -- too complex?

2001-04-26 Thread Tom Lane
Emils Klotins [EMAIL PROTECTED] writes: Running 7.0.2 on Alpha/RedHat 6.2 256MB RAM Update to 7.1. 7.0.* has a lot of portability problems on Alphas, and one of them is that regexps with between 33 and 64 states don't work (int vs long problem...) regards, tom lane

Re: [SQL] problem with pl/pgsql

2001-04-26 Thread Josh Berkus
Mark, I'd love to help you with your PL/pgSQL function, but since I don't read Perl, I can't tell what you're trying to do. Can you spell it out more explicitly? -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] simulate union in subselect

2001-04-26 Thread Peter Eisentraut
Wei Weng writes: I know this is not do-able, but is there any way to simulate the following in Postgresql 7.1? select id from (select id, recv_date as date from table1 union select id, send_date as date from table2) AS subtable order by date; I haven't actually tried whether this does

Re: [SQL] simulate union in subselect

2001-04-26 Thread Tom Lane
Wei Weng [EMAIL PROTECTED] writes: I know this is not do-able, but is there any way to simulate the following in Postgresql 7.1? select id from (select id, recv_date as date from table1 union select id, send_date as date from table2) AS subtable order by date; What gives you the idea

[SQL] No JOINs in UPDATE ... FROM?

2001-04-26 Thread Josh Berkus
Folks, In 7.1 RC2, I've been trying to use the following JOIN syntax: UPDATE assignments SET status = -1 FROM assignments JOIN orders ON assignments.order_usq = orders.usq WHERE orders.status = -1; However, I get an error of Relation assignments referenced twice in query.

Re: [SQL] random rows

2001-04-26 Thread Joao Pedro M. F. Monoo
Hi! How I can return random N rows from my select stmt? like: e.g. what my selectee is a set of 1000 rows, I want randomly pickup 100 of 1000. use the LIMIT clause example SELECT * FROM test_table LIMIT 100; you can also use the OFFSET clause to skip to n row and the fetch the n desired

[SQL] rules

2001-04-26 Thread Martín Marqués
Is it posible to make a rule execute more then one query? Something like: CREATE RULE rule_name AS ON INSERT TO table1 DO INSTEAD INSERT INTO table2 VALUES (new.value1,new.value2) INSERT INTO table3 VALUES (x,y) If not, is there a way to do this? Triggers maybe? Saludos... :-) -- El mejor

[SQL] Re: rules

2001-04-26 Thread Joel Burton
On Thu, 26 Apr 2001, [iso-8859-1] Martín Marqués wrote: Is it posible to make a rule execute more then one query? Something like: CREATE RULE rule_name AS ON INSERT TO table1 DO INSTEAD INSERT INTO table2 VALUES (new.value1,new.value2) INSERT INTO table3 VALUES (x,y) test=# \h

Re: [SQL] rules

2001-04-26 Thread Jan Wieck
Martín Marqués wrote: Is it posible to make a rule execute more then one query? Something like: CREATE RULE rule_name AS ON INSERT TO table1 DO INSTEAD INSERT INTO table2 VALUES (new.value1,new.value2) INSERT INTO table3 VALUES (x,y) Yes: CREATE RULE rule_name AS ON INSERT

Re: [SQL] No JOINs in UPDATE ... FROM?

2001-04-26 Thread Tom Lane
Josh Berkus [EMAIL PROTECTED] writes: UPDATE assignments SET status = -1 FROM assignments JOIN orders ON assignments.order_usq = orders.usq WHERE orders.status = -1; However, I get an error of Relation assignments referenced twice in query. Now, I can (and have) re-phrase

[SQL] Re: random rows

2001-04-26 Thread Joel Burton
On Thu, 26 Apr 2001, Jie Liang wrote: How I can return random N rows from my select stmt? like: e.g. what my selectee is a set of 1000 rows, I want randomly pickup 100 of 1000. Interesting problem. You might get much better responses than this, but, two ideas that might be workable: *

[SQL] random rows

2001-04-26 Thread Jie Liang
How I can return random N rows from my select stmt? like: e.g. what my selectee is a set of 1000 rows, I want randomly pickup 100 of 1000. thanks. Jie LIANG St. Bernard Software 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED]

[SQL] simulate union in subselect

2001-04-26 Thread Wei Weng
I know this is not do-able, but is there any way to simulate the following in Postgresql 7.1? select id from (select id, recv_date as date from table1 union select id, send_date as date from table2) AS subtable order by date; Thanks a lot Wei ---(end of

Re: [SQL] Regexps -- too complex?

2001-04-26 Thread Emils Klotins
SELECT id, title,publishdate,categoryid FROM articles WHERE upper(title) ~ '(BLACK|SERIOUS|SAM)[[::]]'::text ; I think the proiblem is in trnsalte, not in regexp If you have installed apprporiate character encoding in Postgres, 'upper' will work! Vladimir Thanks for the advice,

[SQL] realising a counter in an pgpsql-trigger

2001-04-26 Thread chris Günther
Hi folks, I want to do the following: I have a column in every table, named c_update, it's purpose is to hold how many times the dataset was updated. This should be done automatically by the trigger - which already set sthe update-user, -time and date. How can I do this ??? chris

Re: [SQL] realising a counter in an pgpsql-trigger

2001-04-26 Thread Kenn Thompson
Hate to be entirely off topic, but can anyone help me with changing to digest version of the listserv subscription? I've been all over the site, and can't find the instructions. chris G*nther [EMAIL PROTECTED] 04/26/01 09:17AM Hi folks, I want to do the following: I have a column in every