[SQL] Large objects and Meta Data

2002-07-16 Thread Dror Matalon
Hi, I'm handling large objects from JDBC in a servlet environment. Every time we create a lo we also create a row in the zp_file table that holds additional information about the file, as well as the oid of the large object: Column | Type | Modifiers -+

Re: [SQL] Cascading deletions does not seem to work inside PL/PGSQL functions.

2002-07-16 Thread Rajesh Kumar Mallah.
On Tuesday 16 July 2002 21:41, you wrote: > On Tue, 16 Jul 2002, Rajesh Kumar Mallah. wrote: > > Hi folks, > > > > This problem has been troubling me for quite sometime and > > I would be very thankful for your help. > > > > I have included the complete commented script to recreate the problem in

Re: [SQL] A SQL Training

2002-07-16 Thread Achilleus Mantzios
On Tue, 16 Jul 2002, Devrim GUNDUZ wrote: You need to identify your problem: preorder traversal on a tree using pointers for the fathers. Then you have to prove (or prove the opposite) that SQL alone is capable of expressing what you need. BTW, Nested Sets are only good for "static" databases. P

Re: [SQL] Sequence name length

2002-07-16 Thread Rudi Starcevic
Hi Tom, Here is the output from 'select version()' PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.95.2 Cheers Rudi. Tom Lane wrote: >Rudi Starcevic <[EMAIL PROTECTED]> writes: > > >>Just a quick one on the length of the name of a sequence. >>... >>However the sequence created is nam

Re: [SQL] Sequence name length

2002-07-16 Thread Christopher Kings-Lynne
> > However the sequence created is named : > > eselect_maincategory_maincat_id ( the '_seq' is lopped off ) > > What version are you running? Anything recent will keep the '_seq' > and lop elsewhere. Not if he's manually creating a sequence name that's too long - it will just truncate it me

Re: [SQL] Sequence name length

2002-07-16 Thread Tom Lane
Rudi Starcevic <[EMAIL PROTECTED]> writes: > Just a quick one on the length of the name of a sequence. > ... > However the sequence created is named : > eselect_maincategory_maincat_id ( the '_seq' is lopped off ) What version are you running? Anything recent will keep the '_seq' and lo

Re: [SQL] Sequence name length

2002-07-16 Thread Christopher Kings-Lynne
Hi Rudi, Unless you redefine it before compiling, postgres has a built-in limit of 31 characters for names. Increasing this has a performance penalty, but it might happen for 7.3 due to some improvements in the performance area. BTW, the best way to do a sequence primary key is lik ethis: crea

[SQL] Sequence name length

2002-07-16 Thread Rudi Starcevic
Hi, Just a quick one on the length of the name of a sequence. I have some table with long(ish) names like : eselect_maincategory The primary key is named : maincat_id When I create the table the sequence sql looks like nextval('"eselect_maincategory_maincat_id_seq"'::text) Howeve

[SQL] Newbie: Creative use of LIMIT??

2002-07-16 Thread Shmuel A. Kahn
Hello all, Being pretty new at SQL, I have a problem I don't know how to solve. Assuming I have the following two tables of people and their nicknames, and that I want to create a list containing UPTO 2 (or any value greater than 1) nicknames for EACH member of a specific family (Fam column),

Re: [SQL] Indexing UNIONs

2002-07-16 Thread Josh Berkus
Bruno, > This sounds like a design issue. This makes it seem like the events > should be broken out into their own table and the other two tables > should get joined with the events table when needed. > OK, I guess I'll have to get into detail: Table "cases" is the database's third largest tab

Re: datatype matrix (was: Re: [SQL] Sorry..)

2002-07-16 Thread Josh Berkus
Kevin, > In this vain, is there someplace in the docs that has a type conversion > table (matrix) that shows what datatype can be cast into what other > datatype (both implicitly and explicitly)? I haven't seen one and it > would be helpful for us newbies. I don't think it exists. Hey, ho

Re: [SQL] Need help on a troublesome query plan

2002-07-16 Thread Stephan Szabo
On Tue, 16 Jul 2002, Alain Lavigne wrote: > Thanks that worked, but why does that happen or maybe you could point > to the proper thread so I read up on it. It's an issue that the numeric constant gets cast to int4 somewhat prematurely. I don't have a pointer to a thread off hand, but if you se

Re: [SQL] Indexing UNIONs

2002-07-16 Thread Bruno Wolff III
On Tue, Jul 16, 2002 at 09:36:31 -0700, Josh Berkus <[EMAIL PROTECTED]> wrote: > Bruno, > > > It wouldn't have to be a dummy table. You could have both sets of > > data > > in the same table. > > Per my original e-mail, this is not an option. > > Basically, the two tables have nothing in co

Re: [SQL] Need help on a troublesome query plan

2002-07-16 Thread Stephan Szabo
On Tue, 16 Jul 2002, Alain Lavigne wrote: > Index "bld_x1_tb_bus_fact" > Column | Type > -+--- > party_id| bigint > bus_fact_typ_cd | character(10) > cont_id | bigint > btree > > With the following query on 5 records: > > expla

[SQL] Need help on a troublesome query plan

2002-07-16 Thread Alain Lavigne
On PostgreSQL Version 7.2.1 on Redhat Linux 7.1 Table bld_tb_bus_fact definition Column | Type | Modifiers -+-- +--- bus_fact_id| bigint| not nu

Re: [SQL] A SQL Training

2002-07-16 Thread Josh Berkus
Devrim, > Today, one of my teacher asked me a question for a practice... I could not > solve it :) > > Here it comes: > > We are given the name of the grandfather in a family. Let's call him A. A > has n sons, each son has children . etc. In a month or so, I will be posting an article on ad

datatype matrix (was: Re: [SQL] Sorry..)

2002-07-16 Thread Kevin Brannen
Josh Berkus wrote: > Christopher, > > >>In the bad old days when we couldn't distinguish explicit from implicit >>cast functions, I was wary of adding new cast pathways. Too many >>implicit casts and you have no type system at all. But in 7.3 there >>should be no reason to object to an explici

[SQL] A SQL Training

2002-07-16 Thread Devrim GUNDUZ
Hi, Today, one of my teacher asked me a question for a practice... I could not solve it :) Here it comes: We are given the name of the grandfather in a family. Let's call him A. A has n sons, each son has children . for example. A -> Grandfather / \

Re: [SQL] Indexing UNIONs

2002-07-16 Thread Josh Berkus
Bruno, > It wouldn't have to be a dummy table. You could have both sets of > data > in the same table. Per my original e-mail, this is not an option. Basically, the two tables have nothing in commmon *except* that events can be scheduled against either table. Otherwise, the two tables have

Re: [SQL] Cascading deletions does not seem to work inside PL/PGSQL

2002-07-16 Thread Stephan Szabo
On Tue, 16 Jul 2002, Rajesh Kumar Mallah. wrote: > Hi folks, > > This problem has been troubling me for quite sometime and > I would be very thankful for your help. > > I have included the complete commented script to recreate the problem in > question. > > The problem is inside a plpgsql functio

Re: [SQL] Indexing UNIONs

2002-07-16 Thread Bruno Wolff III
On Mon, Jul 15, 2002 at 17:31:24 -0700, Josh Berkus <[EMAIL PROTECTED]> wrote: > Stephan, > > > We had a discussion recently on -general about this. Right now the > > planner won't push the conditions down into the arms of the union because > > noone's been sure under what conditions the optim

Re: [SQL] How do I concatenate row-wise instead of column-wise?

2002-07-16 Thread Rajesh Kumar Mallah.
Hi Marcus, It is simple , you need to write a function and define an aggregate using that function. in case you have already searched for the solution and not found here it is from this mailing list only: === Date: Tue

[SQL] Cascading deletions does not seem to work inside PL/PGSQL functions.

2002-07-16 Thread Rajesh Kumar Mallah.
Hi folks, This problem has been troubling me for quite sometime and I would be very thankful for your help. I have included the complete commented script to recreate the problem in question. The problem is inside a plpgsql function i do not see the records in the slave tables getting deleted

Re: [SQL] How do I concatenate row-wise instead of column-wise?

2002-07-16 Thread Richard Huxton
On Tuesday 16 Jul 2002 9:09 am, Marcus Claesson wrote: > I have a table like this: > SELECT * FROM old_tab; > id|descr > --- > 3|ddd > 3|ddd > 3|eee > 3|fff > SELECT * FROM new_tab; > id|descr > -- > 1|

Re: [SQL] [HACKERS] please help on query

2002-07-16 Thread Luis Alberto Amigo Navarro
- Original Message - From: "Masaru Sugawara" <[EMAIL PROTECTED]> To: "Luis Alberto Amigo Navarro" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, July 15, 2002 6:15 PM Subject: Re: [SQL] [HACKERS] please help on query > > Sorry, I don't know the reason. > I need more info. Ca

[SQL] How do I concatenate row-wise instead of column-wise?

2002-07-16 Thread Marcus Claesson
I have a table like this: SELECT * FROM old_tab; id|descr --- 1|aaa 1|aaa 1|bbb 2|ccc 2|bbb 3|ddd 3|ddd 3|eee 3|fff 4|bbb etc... And I want a new table where the descr is concatenated