Re: [SQL] Searching for results with an unknown amount of data

2005-09-05 Thread Thomas F. O'Connell
On Sep 2, 2005, at 2:40 PM, DownLoad X wrote: Hi, I've got two tables, A and B, the first one containing columns A_ID | info where A_ID is primary, so that this table stores various information about an object, and the second containing columns A_ID | property where property is an integ

Re: [SQL] ERROR: syntax error at or near "select" at character 9

2005-09-05 Thread Stephan Szabo
On Fri, 2 Sep 2005, [ISO-8859-2] Graf L?szl? wrote: > >CREATE FUNCTION test_verif() RETURNS trigger AS $test_verif$ >BEGIN >NEW.id := select nextval('test_azon_seq'); I think you want to remove select here, you're already effectively doing a select of the right hand side

Re: [SQL] Weird Trigger Behaviour using IF ... THEN ... ESLEIF...

2005-09-05 Thread Stephan Szabo
On Mon, 5 Sep 2005, Antony Sohal wrote: > Please can you help me with the following trigger I have written in > PostgreSQL 7.4.8 running under Fedora Linux, using pgAdmin III as > client. > Now I create a trigger on event table as : > > CREATE OR REPLACE FUNCTION fn_event() > RETURNS "trigger"

Re: [SQL] Table Constraint CHECK(SELECT()) alternative?

2005-09-05 Thread Dinesh Pandey
You can create a function and call it from a trigger on that column insert event Thanks Dinesh Pandey -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert D. Kennedy Sent: Sunday, September 04, 2005 12:20 AM To: pgsql-sql@postgresql.org Cc: [EMAIL PROT

Re: [SQL] Table Constraint CHECK(SELECT()) alternative?

2005-09-05 Thread Stephan Szabo
On Sat, 3 Sep 2005, Robert D. Kennedy wrote: > I have seen in another thread that sub-queries in a CHECK > constraint have implementation ramifications that make them awkward to > implement and support. OK, fair enough, c'est la vie. > > ERROR: cannot use subquery in check constraint > > is

[SQL] Performance issue

2005-09-05 Thread Ricky Sutanto
I use Apache Web Server and PostgreSQL 7.3 to collect data everyday. Now it has been 5 month since I install that server. I wonder why now my web very slow to retrieve and display data? When I check the memory, I found that postgreSQL client seem not release after allocate. I try to find bug on

Re: [SQL] sql function: using set as argument

2005-09-05 Thread Akshay Mathur
Found a solution   Second function can be written as     Get_count(anyarray, int)     Select count(b_column) from some_table where some_field_1 any ($1) and some_field_2 = $2;   Calling this function:     Select Get_count(array(functio

Re: [SQL] [GENERAL] How do I copy part of table from db1 to db2 (and

2005-09-05 Thread Tino Wildenhain
Joost Kraaijeveld schrieb: On Wed, 2005-08-31 at 12:40 +0200, Roman Neuhauser wrote: check these man pages: pg_dump(1), pg_restore(1), alter_table(7) I am afraid that the problem is more complex. The original database (which is created with SQL_ASCII) contains invalid byte sequences in s

Re: [SQL] insert only if conditions are met?

2005-09-05 Thread Chris Travers
Henry Ortega wrote: What I am trying to do is * Insert a record for EMPLOYEE A to TABLE A IF the sum of the hours worked by EMPLOYEE A on TABLE A is not equal to N Is this possible? Yes, but we will need to see your database schema to provide examples. A simple example might be INSERT INTO

Re: [SQL] [GENERAL] How do I copy part of table from db1 to db2 (and rename the columns)?

2005-09-05 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-08-31 12:00:30 +0200: > I want to copy several columns of a source table from db1 to db2, and > create the target table and rename the columns in the process. > > Is that possible in PostgresQL? If so, an example or url for such a > command /script would be appreciated.

[SQL] ERROR: syntax error at or near "select" at character 9

2005-09-05 Thread Graf László
Hi I am using PG 8.0 on Win32, learning SQL. I dod create a table with the following SQL: CREATE TABLE test ( id integer, nev varchar(25), datum timestamp ); A sequence with: CREATE SEQUENCE "public"."test_azon_seq" INCREMENT 1 MINVALUE 101 MAXVALUE 9223372

[SQL] SQL queries

2005-09-05 Thread Joÿffffffffffe3o Carvalho
HiIm having problems doing some SQL queries, they are this ones:-List lock users-Show schema owners-Check if a certain table has a toast tableIf any one could help that would be good.Regards__Converse com seus amigos em tempo real com o Yahoo! Messeng

[SQL] Table Constraint CHECK(SELECT()) alternative?

2005-09-05 Thread Robert D. Kennedy
Hello, I have seen in another thread that sub-queries in a CHECK constraint have implementation ramifications that make them awkward to implement and support. OK, fair enough, c'est la vie. ERROR: cannot use subquery in check constraint is the result. I have a model which seems to BE

[SQL] Searching for results with an unknown amount of data

2005-09-05 Thread DownLoad X
Hi, I've got two tables, A and B, the first one containing columns A_ID | info where A_ID is primary, so that this table stores various information about an object, and the second containing columns A_ID | property where property is an integer referring to a particular property that an obj

[SQL] Weird Trigger Behaviour using IF ... THEN ... ESLEIF... THEN... ELSEIF... THEN ... ELSE ... END IF;

2005-09-05 Thread Antony Sohal
Hi   Please can you help me with the following trigger I have written in PostgreSQL 7.4.8 running under Fedora Linux, using pgAdmin III as client.   For events in a system, I wanted to break up a string which is a log statement (inserted into event table) into key-value pairs (where the str

Re: [SQL] Equivalent of Oracle SQL%NOTFOUND in plpgsql

2005-09-05 Thread Tom Lane
"Bath, David" <[EMAIL PROTECTED]> writes: >In PL/SQL I can write some like the following: > fetch cursorblah into blurble; > if cursorname%NOTFOUND . See the FOUND variable: http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS

[SQL] Equivalent of Oracle SQL%NOTFOUND in plpgsql

2005-09-05 Thread Bath, David
Folks, Background: I'm an old Oracle PL/SQL guy. In PL/SQL I can write some like the following: fetch cursorblah into blurble; if cursorname%NOTFOUND . or use the more general SQL%NOTFOUND symbol that is not specific to a cursor. There are similar "easy" variables t

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Am Montag, 5. September 2005 17:40 schrieb Harald Fuchs: >> I dunno the details of the supported encodings, but is there >> any encoding where 'a-z' includes more or less than 26 letters? > Well, it seems that our regexp library interprets [a-z] as e

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread Peter Eisentraut
Am Montag, 5. September 2005 17:40 schrieb Harald Fuchs: > How so? I thought character ranges are more an encoding than a locale > issue. That is incorrect. > I dunno the details of the supported encodings, but is there > any encoding where 'a-z' includes more or less than 26 letters? Well, it

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread Peter Eisentraut
Am Montag, 5. September 2005 17:13 schrieb Alvaro Herrera: > Note that [:alpha:] and such character classes are defined by POSIX to > be locale independent: > > alvherre=# select 'á' ~ '[a-z]'; > ?column? > -- > f > (1 fila) > > alvherre=# select 'á' ~ '[[:alpha:]]'; > ?column? > ---

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Peter Eisentraut <[EMAIL PROTECTED]> writes: > Presumably, > colname ~ '^[A-Za-z]*$' > If you want to be independent of locale issues, then you'd have to enumerate > all the letters instead of using a range specification. How so? I thought character ranges

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread Peter Eisentraut
Am Montag, 5. September 2005 17:10 schrieb A. Kretschmer: > > colname ~ '^[A-Za-z]*$' > > This match also a empty string. An empty string also fulfulls the condition "only with characters A-Za-z". Or maybe not. :-) -- Peter Eisentraut http://developer.postgresql.org/~petere/ -

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread Alvaro Herrera
On Mon, Sep 05, 2005 at 04:19:28PM +0200, Peter Eisentraut wrote: > Am Montag, 5. September 2005 15:57 schrieb Aldor: > > I want to get out a string only with characters A-Za-z. > > Any idea how to do this in Postgres with POSIX Regex? > > Presumably, > > colname ~ '^[A-Za-z]*$' > > If you w

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread A. Kretschmer
am 05.09.2005, um 16:19:28 +0200 mailte Peter Eisentraut folgendes: > Am Montag, 5. September 2005 15:57 schrieb Aldor: > > I want to get out a string only with characters A-Za-z. > > Any idea how to do this in Postgres with POSIX Regex? > > Presumably, > > colname ~ '^[A-Za-z]*$'

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread Peter Eisentraut
Am Montag, 5. September 2005 15:57 schrieb Aldor: > I want to get out a string only with characters A-Za-z. > Any idea how to do this in Postgres with POSIX Regex? Presumably, colname ~ '^[A-Za-z]*$' If you want to be independent of locale issues, then you'd have to enumerate all the letter

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread Michael Fuhr
On Mon, Sep 05, 2005 at 02:57:06PM +0100, Aldor wrote: > > I want to get out a string only with characters A-Za-z. > > I tried really a lot of things with substring and read many POSIX docs, > I'm also familiar with the Perl RegEx but right now, I'm giving up... ;-( > > Any idea how to do this i

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread A. Kretschmer
am 05.09.2005, um 14:57:06 +0100 mailte Aldor folgendes: > Hi, > > I want to get out a string only with characters A-Za-z. like this? test=# select * from foo; s 123 abz abz123 (3 rows) test=# select * from foo where s ~ '^[a-zA-Z]+$'; s - abz (1 row) > Any idea how to

[SQL] POSIX Regular Expression question

2005-09-05 Thread Aldor
Hi, I want to get out a string only with characters A-Za-z. I tried really a lot of things with substring and read many POSIX docs, I'm also familiar with the Perl RegEx but right now, I'm giving up... ;-( Any idea how to do this in Postgres with POSIX Regex? Regards, Aldor --