Re: [SQL] preventing deletion of a row

2005-06-06 Thread Kenneth Gonsalves
On Tuesday 07 Jun 2005 11:29 am, Nick Johnson wrote: > >if the value of 'fixed' is TRUE, then this row cannot be deleted. > > How do i enforce this condition? > >   > > Try this: > CREATE RULE tablename_delete AS ON DELETE TO tablename WHERE > OLD.fixed = TRUE DO INSTEAD NOTHING; cool - thanks --

Re: [SQL] large object support in PostGres 7.4

2005-06-06 Thread Volkan YAZICI
Hi, On 6/7/05, Vadivel Subramaniam <[EMAIL PROTECTED]> wrote: > My doubt is, do these API's operate on character data? i.e., My table > schema is like this > > table (name varchar, script varchar). I have to store a large data(in > character form) in the script column (upto 3 MB). > > As of m

[SQL] large object support in PostGres 7.4

2005-06-06 Thread Vadivel Subramaniam
Hi, We have API's in /usr/local/pgsql/include/libpq-fe.h which support large objects in PostGres extern int lo_open(PGconn *conn, Oid lobjId, int mode); extern int lo_close(PGconn *conn, int fd); extern int lo_read(PGconn *conn, int fd, char *buf, size_t len); extern

Re: [SQL] preventing deletion of a row

2005-06-06 Thread Nick Johnson
Kenneth Gonsalves wrote: hi i have a table of the type: id serial unique, name varchar(50), fixed boolean default FALSE if the value of 'fixed' is TRUE, then this row cannot be deleted. How do i enforce this condition? Try this: CREATE RULE tablename_delete AS ON DELETE TO tablename WHERE

Re: [SQL] What is faster?

2005-06-06 Thread ON.KG
RH> ON.KG wrote: >> Hi All! >> What is faster - SLECTion data from one large table (200 000 - 300 000 records), or SELECTion from a few small tables (example, 2 tables 150 000 records each)? >> >> For example i have two large tables >> Structure of tables is same - has two fields - id

[SQL] datestyle syntax

2005-06-06 Thread Kenneth Gonsalves
hi in the query: alter database dbname set datestyle='DMY','European'; what is the significance of the two parameters given in datestyle. I assumed that one is input and the other is output, but if i put: set datestyle='DMY','DMY' i get an error saying 'conflicting datestyles' -- regards kg htt

[SQL] preventing deletion of a row

2005-06-06 Thread Kenneth Gonsalves
hi i have a table of the type: id serial unique, name varchar(50), fixed boolean default FALSE if the value of 'fixed' is TRUE, then this row cannot be deleted. How do i enforce this condition? -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.sourceforge.net ಇಂಡ್ಲಿನ

Re: [SQL] SQL equivalent to nested loop

2005-06-06 Thread Markus Bertheau
Dnia 06-06-2005, pon o godzinie 20:08 +0200, KÖPFERL Robert napisał(a): > This is basicly a Join, a cross table > > i.e. > > select b.w from table a, table b where ... You'd hope that. The problem is that you don't have the tables and afterwards specify the join condition, but in specifying the

Re: [SQL] SQL equivalent to nested loop

2005-06-06 Thread KÖPFERL Robert
This is basicly a Join, a cross table i.e. select b.w from table a, table b where ... |-Original Message- |From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] |Sent: Montag, 06. Juni 2005 18:53 |To: pgsql-sql@postgresql.org |Subject: [SQL] SQL equivalent to nested loop | | |Hi, | |I bas

[SQL] SQL equivalent to nested loop

2005-06-06 Thread Markus Bertheau ☭
Hi, I basically need the SQL equivalent of the following pseudo code: BEGIN FOR v IN SELECT * FROM f(4, 'foo') LOOP FOR w IN SELECT * FROM f(v.id, 'bar') LOOP RETURN NEXT W END LOOP; END LOOP; RETURN; Is that possible in SQL? Markus -- Markus Bertheau ☭ <[EMAIL PROTECTED]> -

Re: [SQL] How do write a query...

2005-06-06 Thread Bruno Wolff III
On Wed, Jun 01, 2005 at 18:00:49 +0200, Alain Reymond <[EMAIL PROTECTED]> wrote: > Hello, > > I have the following problem : > > I have a table like > IdNum Date AValue > 1 10 01/01/2005 50 > 2 10 31/05/2005 60 > 3 25

Re: [SQL] What is faster?

2005-06-06 Thread Richard Huxton
ON.KG wrote: Hi All! What is faster - SLECTion data from one large table (200 000 - 300 000 records), or SELECTion from a few small tables (example, 2 tables 150 000 records each)? RH> It depends. Are you selecting all records? One record? A few records? If RH> one or a few, do you have a sui

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-06-06 Thread Joe Conway
Tom Lane wrote: Markus Bertheau =?UTF-8?Q?=E2=98=AD?= <[EMAIL PROTECTED]> writes: By analogy, array_upper('{}'::TEXT[], 1) should return 0 instead of NULL. No, that doesn't follow ... we've traditionally considered '{}' to denote a zero-dimensional array. A 1-D array of no elements is '[1:0]

Re: [SQL] What is faster?

2005-06-06 Thread ON.KG
Hi All! >> What is faster - SLECTion data from one large table (200 000 - 300 000 >> records), or SELECTion from a few small tables (example, 2 tables 150 >> 000 records each)? RH> It depends. Are you selecting all records? One record? A few records? If RH> one or a few, do you have a suitable in

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-06-06 Thread Tom Lane
Markus Bertheau =?UTF-8?Q?=E2=98=AD?= <[EMAIL PROTECTED]> writes: > By analogy, array_upper('{}'::TEXT[], 1) should return 0 instead of > NULL. No, that doesn't follow ... we've traditionally considered '{}' to denote a zero-dimensional array. A 1-D array of no elements is '[1:0]={}', just as Joe

Re: [SQL] What is faster?

2005-06-06 Thread Richard Huxton
ON.KG wrote: Hi All! What is faster - SLECTion data from one large table (200 000 - 300 000 records), or SELECTion from a few small tables (example, 2 tables 150 000 records each)? It depends. Are you selecting all records? One record? A few records? If one or a few, do you have a suitable in

Re: [SQL] how to store more than 3 MB of character data in Postgres Varchar field

2005-06-06 Thread Tom Lane
Vadivel Subramaniam <[EMAIL PROTECTED]> writes: > 2. create table utilntmlscripts (name character varying, data character > varying(10485770)); > ERROR: length for type 'varchar' cannot exceed 10485760 > It's not allowing more than 10 MB of size during table creation. Use type "text",

[SQL] What is faster?

2005-06-06 Thread ON.KG
Hi All! What is faster - SLECTion data from one large table (200 000 - 300 000 records), or SELECTion from a few small tables (example, 2 tables 150 000 records each)? Thank You ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-06-06 Thread Markus Bertheau ☭
В Втр, 24/05/2005 в 00:06 -0400, Tom Lane пишет: > Joe Conway <[EMAIL PROTECTED]> writes: > > Markus Bertheau wrote: > >> why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of > >> ARRAY[] resp. '{}'? > > > Why would you expect an empty array instead of a NULL? > > I think he's got a

Re: [SQL] how to store more than 3 MB of character data in Postgres

2005-06-06 Thread Richard Huxton
Vadivel Subramaniam wrote: I assume, it could not be a problem with ODBC. I am able to store 2.5 MB of data into Oracle using the same ODBC APIs. Well, it certainly isn't to do with PG itself: $ cat bigtest.pl #!/usr/bin/perl print "CREATE TABLE foo (a int, b varchar);\n"; print "INSERT INTO

Re: [SQL] how to store more than 3 MB of character data in Postgres

2005-06-06 Thread Richard Huxton
Vadivel Subramaniam wrote: Hi, We have a requirement wherein we have to store around 3 MB of data in Postgres database. We had gone through the postgres website http://www.postgresql.org/docs/7.4/interactive/datatype-character.html#DATATYPE-CHARACTER-SPECIAL-TABLE The above link says "varc

Re: [SQL] Returning a Cross Tab record set from a function

2005-06-06 Thread KÖPFERL Robert
|-Original Message- |From: Marc Wrubleski [mailto:[EMAIL PROTECTED] |Sent: Mittwoch, 01. Juni 2005 16:15 |To: pgsql-sql@postgresql.org |Subject: [SQL] Returning a Cross Tab record set from a function | [...] | |It seems I can do this from any higher level language, but it drives me |crazy

Re: [SQL] How do write a query...

2005-06-06 Thread KÖPFERL Robert
You could have a look at the OFFSET and LIMIT modifiers as for untested example select ((select max( "AValue") from table group by "Num") - "AValue") as difference from table order by "AValue" desc offset 1 this says: give me a inversed ordered AValue-list but ommitting the first (biggest) and su

[SQL] how to store more than 3 MB of character data in Postgres Varchar field

2005-06-06 Thread Vadivel Subramaniam
Hi, We have a requirement wherein we have to store around 3 MB of data in Postgres database. We had gone through the postgres website http://www.postgresql.org/docs/7.4/interactive/datatype-character.html#DATATYPE-CHARACTER-SPECIAL-TABLE The above link says "varchar" can store upto 1 GB of