Re: [SQL] postgres

2000-12-13 Thread Roberto Mello
On Wed, Dec 13, 2000 at 04:44:55PM -0800, Josh Berkus wrote: > Mr. Daoust, > > You have reached the PostgreSQL SQL developers mailing list. We are > not PostgreSQL sales people, and we have no marketing information to > sell you. Please have a clue. Errr... forgive me, but maybe

[SQL] How to insert/select date fields in a particular format

2000-12-13 Thread Ramesh H R
Hello everyone, Please help me in knowing how to insert/select date fields in a particular format in postgres. Thanks in advance Ramesh

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Robert B. Easter
On Wednesday 13 December 2000 18:05, Josh Berkus wrote: > Frank, etc: > > > create table Category ( > > > CategoryID int4 not null primary key, > > > ParentCategoryID int4 not null REFERENCES Category (CategoryID), > > > CategoryName varchar(100) > > > ); I made a message board with

Re: [SQL] Null comparison

2000-12-13 Thread Robert B. Easter
I wrote some notes on three-valued logic (true,false,unknown) at my website: http://www.comptechnews.com/~reaster/dbdesign.html#three-valued-logic If anyone finds errors with it, please let me know. On Wednesday 13 December 2000 19:03, Stephan Szabo wrote: > On Wed, 13 Dec 2000, Al Lewis wrote:

Re: [SQL] Strange slow behavior in backend

2000-12-13 Thread Tom Lane
Kyle <[EMAIL PROTECTED]> writes: > This worked great until I put a real big file in (about 5M). Then, when > I tried to fetch the file, it seemed really slow (about 60 seconds). I > tried reassembling the file in the frontend instead and my time dropped > to about 6 seconds using this TCL fragme

Re: [SQL] postgres

2000-12-13 Thread John Hasler
Joseph Shraibman writes: > I've been wondering for a long time how people manage to find the mailing > list without finding the web site. They do a Web search on 'postgres' and get a zillion hits on articles in the list archive. They then look at the first article and pull the address out of tha

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread clayton cottingham
Mathijs Brands wrote: > > On Wed, Dec 13, 2000 at 04:49:51PM -0800, Josh Berkus allegedly wrote: > > Stuart, > > > > > I don't think I'd be comfortable with having the node_level column in the > > > table structure. First, because you can derive that value using a function, > > > it's duplicate d

Re: [SQL] postgres

2000-12-13 Thread Joseph Shraibman
"Brett W. McCoy" wrote: > > On 13 Dec 2000, Marc Daoust wrote: > > > I in the search for a DB that would work with our product and have been told > > to have a look at postgres. Would you be able to foward me any information on > > your product and or point me to where I might be able to find s

RE: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Opec Kemp \( Ozemail \)
Don't if this will help but there is a really good book that discuss this problem in details. The book is called "SQL for Smarties" by Joe Celko. It covers lots of advance topics (tree being one of them). Very good book. Check out on Amazon: http://www.amazon.com/exec/obidos/ASIN/1558605762/qid

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Mathijs Brands
On Wed, Dec 13, 2000 at 04:49:51PM -0800, Josh Berkus allegedly wrote: > Stuart, > > > I don't think I'd be comfortable with having the node_level column in the > > table structure. First, because you can derive that value using a function, > > it's duplicate data. Second, if you decide to take a

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Mathijs Brands
On Wed, Dec 13, 2000 at 12:09:06PM -0800, Stuart Statman allegedly wrote: > > The way I'd do it if I had to do it again: > > Give each record a unique id, generated by the application. > > Denote levels with extra letters. > > > > So: > > > >AA - Automotive transport > > - Cars >

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Josh Berkus
Stuart, > I don't think I'd be comfortable with having the node_level column in the > table structure. First, because you can derive that value using a function, > it's duplicate data. Second, if you decide to take an entire segment of your > hierarchy and move it under another node (by changing

Re: [SQL] postgres

2000-12-13 Thread Brett W. McCoy
On 13 Dec 2000, Marc Daoust wrote: > I in the search for a DB that would work with our product and have been told > to have a look at postgres. Would you be able to foward me any information on > your product and or point me to where I might be able to find some. You should start with www.postg

Re: [SQL] postgres

2000-12-13 Thread Josh Berkus
Mr. Daoust, You have reached the PostgreSQL SQL developers mailing list. We are not PostgreSQL sales people, and we have no marketing information to sell you. Please have a clue. I suggest that you try http://www.postgresql.org/ and http://www.pgsql.com/ for more information.

RE: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Stuart Statman
[Josh Berkus] > I've done this before for one project. Here's what you do: > > CREATE TABLE sample_heirarchy ( > unique_id SERIAL CONSTRAINT PRIMARY KEY, > node_linkup INT4, > node_level INT2, > label VARCHAR(30) > data

[SQL] postgres

2000-12-13 Thread Marc Daoust
Hi, I in the search for a DB that would work with our product and have been told to have a look at postgres. Would you be able to foward me any information on your product and or point me to where I might be able to find some. Thank you in advance for your help! Marc

Re: [SQL] Null comparison

2000-12-13 Thread Stephan Szabo
On Wed, 13 Dec 2000, Al Lewis wrote: > I am migrating to postgress from msql and am encountering numerous problems > in the differences in NULL usage and comparison. > > 1. Why are 2 fields not equal if they are both NULL? Because that's what the SQL spec says. If either value is NULL the resu

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Josh Berkus
Frank, etc: > > create table Category ( > > CategoryID int4 not null primary key, > > ParentCategoryID int4 not null REFERENCES Category (CategoryID), > > CategoryName varchar(100) > > ); That was it. I also gave an example of a UNION query that would display the whole category tr

RE: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Stuart Statman
> What I am thinking now is that you would keep the index > in a separate index table linked with the primary > key in the articles table), which would have 6 or 7 fields > initially, and that you'd add columns with the alter table > command, if need be, to make the structure deeper. I would sugg

[SQL] plpgsql

2000-12-13 Thread Jie Liang
Hi, How can I declare an array in plpgsql?? when I use declare url text[10]; ERROR: parse error at or near "[" if I use _text; declare is OK, however, when I assgin a value after BEGIN url[i]:=whatever; get same ERROR, Is it possible to return an array from a plpgsql function?? Jie LIANG Inter

RE: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Stuart Statman
> The way I'd do it if I had to do it again: > Give each record a unique id, generated by the application. > Denote levels with extra letters. > > So: > >AA - Automotive transport > - Cars >AAAB - Motorcycles > > The structures has the added bonus of making it very easy to >

[SQL] Query by sresultset.getArray(index)

2000-12-13 Thread Frank Mingan You
I wanted to get array data from Java ResultSet object but error was reported: This method is not yet implemented.  at org.postgresql.Driver.notImplemented(Driver.java:368)  at org.postgresql.jdbc2.ResultSet.getArray(ResultSet.java:836)  at PersistentObject.populateDomainModel(PersistentObject.jav

[SQL] Null comparison

2000-12-13 Thread Al Lewis
I am migrating to postgress from msql and am encountering numerous problems in the differences in NULL usage and comparison. 1. Why are 2 fields not equal if they are both NULL? 2. Is there a way to easily modify my sql select statements to account for either column being NULL and having them re

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread clayton cottingham
Frank Joerdens wrote: > > On Wed, Dec 13, 2000 at 11:04:13AM -0800, Josh Berkus wrote: > > Frank, > > > > Please look in the list archives. About 2 months ago this topic came > > up and was discussed extensively (including a creative solution by yours > > truly). > > Hm, neither my archiv

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Frank Joerdens
On Wed, Dec 13, 2000 at 11:04:13AM -0800, Josh Berkus wrote: > Frank, > > Please look in the list archives. About 2 months ago this topic came > up and was discussed extensively (including a creative solution by yours > truly). Hm, neither my archives nor a search on the postgresql.org pa

Re: [SQL] Selecting Most Recent Row

2000-12-13 Thread Steve Meynell
Joel, Thank you very much. I gave that a try and it worked perfectly. It definately was the distinct keyword I was missing. Thanks Again, Steve Joel Burton wrote: > > Will DateStamp being the date of insertion? If so, is it that you want > the record for the most recent (largest) datesta

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Frank Joerdens
On Wed, Dec 13, 2000 at 11:38:18AM -0800, Stuart Statman wrote: [ . . . ] > I would suggest, instead, to create a table that represents your hierarchy > without adding columns. For example : > > create table Category ( > CategoryID int4 not null primary key, > ParentCategoryID int4 not n

Re: [SQL] Selecting Most Recent Row

2000-12-13 Thread Joel Burton
> Ok here is the problem. > Table: Widgets > Fields: Unique_Key, DateStamp, Batch_Number, Instructions. > > Basic Select Statement: > select Unique_Key from Widgets where Batch_Number>='inputedvalue' > > Problem: > Some Batch_Numbers might be duplicated over a period of time. I want > to selec

Re: [SQL] Decimal vs.Numeric vs. Int & type for OID

2000-12-13 Thread Peter Eisentraut
Nikhil G. Daddikar writes: > It is unclear to me what the real difference is and when to use what. > Any pointers would be greatly appreaciated. Integers are integers (uh...) Numeric is for exact fixed-point decimal numbers. Monetary amounts are a good example. Decimal is equivalent to numeri

Re: [SQL] How to represent a tree-structure in a relationaldatabase

2000-12-13 Thread miguel sofer
I once started writing a small paper on this subject; it is still in a rather preliminary state. You can download the draft (and some ill documented code, 53kB) from http://www.utdt.edu/~mig/sql-trees Miguel >> Original Message << On 12/13/00, 12:48:47 PM, F

Re: [SQL] SQL parse error

2000-12-13 Thread Borek Lupoměský
On Wed, 13 Dec 2000, Tom Lane wrote: TL> =?ISO-8859-2?Q?Borek_Lupom=ECsk=FD?= <[EMAIL PROTECTED]> writes: TL> >When I do this, it works for me, too. But when I do it on my current TL> > database, something breaks. TL> TL> Hm. The obvious question is: are you *sure* all the entries in your T

[SQL] Selecting Most Recent Row

2000-12-13 Thread Steve Meynell
Ok here is the problem. Table: Widgets Fields:  Unique_Key, DateStamp, Batch_Number, Instructions. Basic Select Statement: select Unique_Key from Widgets where Batch_Number>='inputedvalue' Problem: Some Batch_Numbers might be duplicated over a period of time.  I want to select the most recent of

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Mathijs Brands
On Wed, Dec 13, 2000 at 04:48:47PM +0100, Frank Joerdens allegedly wrote: > I am just thinking about the data model for a little content management system that >I am > currently planning. Individual articles are sorted under different categories which >branch > into subcategories, sub-subcategor

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Josh Berkus
Frank, Please look in the list archives. About 2 months ago this topic came up and was discussed extensively (including a creative solution by yours truly). -Josh Berkus -- __AGLIO DATABASE SOLUTIONS___

[SQL] Strange slow behavior in backend

2000-12-13 Thread Kyle
I'm using 7.0.1 with a TCL frontend. I have a schema that splits large files into tuple-sized bites and stores them in a table.  This was done before TOAST in order to store large files. I have a backend TCL function that re-assembles the file like this: -- Fetch the specified document data, reas

[SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Frank Joerdens
I am just thinking about the data model for a little content management system that I am currently planning. Individual articles are sorted under different categories which branch into subcategories, sub-subcategories etc. up to a depth of about 6 or 7 levels. The structure should be extensible,

Re: [SQL] SQL parse error

2000-12-13 Thread Tom Lane
=?ISO-8859-2?Q?Borek_Lupom=ECsk=FD?= <[EMAIL PROTECTED]> writes: >When I do this, it works for me, too. But when I do it on my current > database, something breaks. Hm. The obvious question is: are you *sure* all the entries in your table look like ".N"? regards,

Re: [SQL] Postgres closing the connection too fast with php4+apache

2000-12-13 Thread Roberto Mello
On Wed, Dec 13, 2000 at 10:55:03AM +0100, Bruno Boettcher wrote: > > despite this i still get sometimes the dreaded: > Warning: 45 is not a valid PostgreSQL link resource in > /home/bboett/www/fibu/includes/global.php on line 344 >Erreur durant la requete conn = Resource id #45 Pardo

Re: [SQL] SQL parse error

2000-12-13 Thread Borek Lupoměský
On Tue, 12 Dec 2000, Tom Lane wrote: TL> play=> create table out2cp(cp varchar(6)); TL> CREATE TL> play=> insert into out2cp values('3182.1'); TL> INSERT 405833 1 TL> play=> insert into out2cp values('3182.2'); TL> INSERT 405834 1 TL> play=> select substring(cp from 1 for 4)::int4 from out2cp; TL

RE: [SQL] Date Format

2000-12-13 Thread Francis Solomon
Hi Daniel, Try this as your query: SELECT to_char(field, 'DD/MM/') AS "new name"; Hope this helps Francis Solomon > > In MS Access is: > SELECT FORMAT([field],'DD/MM/') AS new name; > How I can make in pgaccess? > > Daniel Hentges > Automação > Fockink In. Eletricas Ltda. > Panam

[SQL] Date Format

2000-12-13 Thread Daniel Hentges
In MS Access is: SELECT FORMAT([field],'DD/MM/') AS new name; How I can make in pgaccess? Daniel Hentges Automação Fockink In. Eletricas Ltda. Panambi - RS - Brasil

[SQL] Great thanks (JDBC). Another probem.

2000-12-13 Thread Mateusz Mazur
Hello. Thank you for your answer (really big thanks). But I have another problem. I try to connect to my linux postgresql server and I have some error. I have linux machine on my local network (e.g. 192.168.1.100), on this machine I have postgresql 7.0.2. In my "pg_hba.conf" file is line like tha

[SQL] Postgres closing the connection too fast with php4+apache

2000-12-13 Thread Bruno Boettcher
Hello, in old days i was used to open the connection to my DB at the begin of the script, make lots of stuff inside the script and eventually close the connection at the end (even if php is supposed to do it for me...). This stopped to work now each time i make a call to the DB i connect, ma

Re: [SQL] select ... for update

2000-12-13 Thread Karel Zak
> > Hi, > > How can I use select ... for update to update limit to update what I > select?? First thing - the SELECT FOR UPDATE is not merge of SELECT and UPDATE but transaction option. The PostgreSQL use row-locking for UPDATEed rows. Standard SELECT ignore this lock, but SELECT FOR UPDATE wa