Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-30 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Also, we have MSSQL, Interbase, and now Oracle modifying > CURRENT_TIMESTAMP during the transaction. (The Oracle report just came > in a few hours ago.) Weren't you dissatisfied with the specificity of that Oracle report? > Perhaps we need a vote on t

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-30 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Notice the part I highlighted. The time returned is > > implementation-dependent "during the execution of S". Now, if we do: > > > BEGIN; > > SELECT CURRENT_TIMESTAMP; > > SELECT CURRENT_TIMESTAMP; > > > the time curre

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-30 Thread Jean-Luc Lachance
OK, forget system_clock() or clock() timeofday() will do. Jean-Luc Lachance wrote: > > How can you make a difference between now('statement'), and > now('immediate'). > To me they are the same thing. Why not simply now() for transaction, and > now('CLOCK') or better yet system_clock() or clock(

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-30 Thread Jean-Luc Lachance
How can you make a difference between now('statement'), and now('immediate'). To me they are the same thing. Why not simply now() for transaction, and now('CLOCK') or better yet system_clock() or clock() for curent time. JLL Josh Berkus wrote: > > Tom, > > > I'd be happier with the whole thing

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Mike Sosteric
On Mon, 30 Sep 2002, Josh Berkus wrote: > > Question #1: If each record has 67 fields, and each field may appear in > several languages, is it possible for some fields to be in more languages > than others? I.e. if "title-en" and "title-de" exist, does it follow that > "content-en" and "con

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Josh Berkus
Mike, > has an language attribute. if there are, say 67 seperate items, each with > multiple languages, then the comlexity of the table structure skyrockets > because you have to allow for multiple titles, multiple names, multiple > everything. This looks soluable several ways. Question #1

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Mike Sosteric
On Mon, 30 Sep 2002, Josh Berkus wrote: Don't worry. Our biggest problem is that each XML data entry, say This is the title has an language attribute. if there are, say 67 seperate items, each with multiple languages, then the comlexity of the table structure skyrockets because you have to a

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-30 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Notice the part I highlighted. The time returned is > implementation-dependent "during the execution of S". Now, if we do: > BEGIN; > SELECT CURRENT_TIMESTAMP; > SELECT CURRENT_TIMESTAMP; > the time currently returned for the second

Re: [SQL] Unique constraint over null values

2002-09-30 Thread Josh Berkus
Thrasher, > I think I'll follow your advice, as this is the method that I had in my > pocket to use if I had no response. I tried with TRIM and other > functions in the CHECK constraint, but I guess that I cannot use > functions over a check field. > > It surprised me, but anyway, I'll do th

Re: [SQL] Unique constraint over null values

2002-09-30 Thread Thrasher
Hi Josh, I think I'll follow your advice, as this is the method that I had in my pocket to use if I had no response. I tried with TRIM and other functions in the CHECK constraint, but I guess that I cannot use functions over a check field. It surprised me, but anyway, I'll do that. Thanks a

Re: [SQL] Unique constraint over null values

2002-09-30 Thread Josh Berkus
Thrasher, > where type can be 's' for 'single' and 'x' for extended, so s should > mean that there is only the type and data1 field, and x means that all > fields are set. > > How can I set a unique constraint like CHECK (type = 's' AND UNIQUE > (type, data1)) OR (type = 'x' AND UNIQUE (type

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Josh Berkus
Mike, > thanks for this. we will stick with the relational model. Hey, don't make your decision entirely based on my advice.Do some research! I'm just responding "off the cuff" to your questions. If you do take the relational approach, post some sample problems here and people can help

Re: [SQL] converting Sybase RULE -> postgreSQL

2002-09-30 Thread Josh Berkus
Charles, You're correct. Most of the wierd stuff below is stuff Sybase invented to get around limitations, and failure to support the SQL standard, in their product. > RULES: > > In the sample below the RULE CloneEnd_type restricts input: the only > data which can be inserted or updated int

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Mike Sosteric
On Mon, 30 Sep 2002, Josh Berkus wrote: thanks for this. we will stick with the relational model. m > > Mike, > > > I have a very good sense of the strengths of relational databases. But > > they are also limited when it comes to object orientaed data (like XML > > records). I though arrays

[SQL] Unique constraint over null values

2002-09-30 Thread Thrasher
Hi all, I have a table like CREATE TABLE a ( typeCHAR (1) NOT NULL, data1 CHAR (16) NOT NULL, data2 CHAR (16) NULL ); where type can be 's' for 'single' and 'x' for extended, so s should mean that there is only the type and data1 field, and x means that all fie

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Josh Berkus
Mike, > I have a very good sense of the strengths of relational databases. But > they are also limited when it comes to object orientaed data (like XML > records). I though arrays would be a way to simply the complexity you get > when you try and map objects to relations. In my experience, mos

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Mike Sosteric
On Mon, 30 Sep 2002, Josh Berkus wrote: I have a very good sense of the strengths of relational databases. But they are also limited when it comes to object orientaed data (like XML records). I though arrays would be a way to simply the complexity you get when you try and map objects to relation

[SQL] converting Sybase RULE -> postgreSQL

2002-09-30 Thread Charles Hauser
Hi, I am still a novice at this so bear with me. I am going to try to alter a Sybase TABLE create script (excerpt below)to postgreSQL. I suspect some of the script is specific to Sybase and I'll just need to remove it. In particular there are numerous stored procedures ("sp_"). But first thing

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Josh Berkus
Dan, > Just in case you or others think Josh is some crazed lunatic[1] who > doesn't know what he's talking about, I support his views on this > topic. Avoid arrays. Normalize your data. And just because I'm a crazed lunatic, that doesn't mean that I don't know what I'm talking about. Um.

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-30 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Now, they are _not_ saying the statement can't have the same time as > > other statements in the transaction, but I don't see why they would > > explicitly have to state that. > > Allow me to turn that around: given that they clearly

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Dan Langille
On 30 Sep 2002 at 12:09, Bruce Momjian wrote: > Dan Langille wrote: > > On 30 Sep 2002 at 8:54, Josh Berkus wrote: > > > > > As such, I'd reccommend one of two approaches for you: > > > > > > 1) Post some of your schema ideas here, and let us show you how they > > > are better done relationally

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Bruce Momjian
Dan Langille wrote: > On 30 Sep 2002 at 8:54, Josh Berkus wrote: > > > As such, I'd reccommend one of two approaches for you: > > > > 1) Post some of your schema ideas here, and let us show you how they > > are better done relationally. The relational data model has 30 years > > of thought beh

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Dan Langille
On 30 Sep 2002 at 8:54, Josh Berkus wrote: > As such, I'd reccommend one of two approaches for you: > > 1) Post some of your schema ideas here, and let us show you how they > are better done relationally. The relational data model has 30 years > of thought behind it -- it can solve a lot of pr

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Josh Berkus
Mike, > We are currently developing a database to host some complicated, XMl > layered data. We have chosen postgres because of its ability to store > multidimensional arrays. We feel that using these will allow us to > simplify the database structure considerably by storing some data in > multid

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Tom Lane
Mike Sosteric <[EMAIL PROTECTED]> writes: > could you select where title[0] = 'en' You certainly could ... but bear in mind that there's no convenient way to make such a query be indexed, at present. So any values that you actually want to use as search keys had better be in their own fields. N

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Bruno Wolff III
On Mon, Sep 30, 2002 at 06:38:56 -0600, Mike Sosteric <[EMAIL PROTECTED]> wrote: > On Mon, 30 Sep 2002, Bruno Wolff III wrote: > > The chances are very very good that in 99% of the cases we'd only ever > have a single title. multiple titles would be rare. and, to make it worse, > there are seve

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Achilleus Mantzios
On Mon, 30 Sep 2002, Bruno Wolff III wrote: > > It is unusual to want to store arrays in a database. Normally you want to > use additional tables instead. For example multilanguage titles is something > I would expect to be in a table that had a column referencing back to > another table defining

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Mike Sosteric
On Mon, 30 Sep 2002, Bruno Wolff III wrote: > > 3) can you do selects on only a portion of a multidimensional array. That > > is, if you were storing multilanguage titles in a two dimensional array, > > > > [en], "english title" > > [fr], "french title" > > > > could you select where title[0]

Re: [SQL] [GENERAL] arrays

2002-09-30 Thread Bruno Wolff III
On Sun, Sep 29, 2002 at 18:12:55 -0600, Mike Sosteric <[EMAIL PROTECTED]> wrote: > On Sun, 29 Sep 2002, Bruce Momjian wrote: > > 3) can you do selects on only a portion of a multidimensional array. That > is, if you were storing multilanguage titles in a two dimensional array, > > [en], "engl