Re: [SQL] Loading JDBC Driver

2000-10-09 Thread Peter Mount

On Thu, 5 Oct 2000, Jos Hernndez Zavala wrote:

> Hello.  
>   
> I am trying to load a jdbc driver for postgres, only I
> want to make it from an Applet. For an application I
> used  the form:  
>   
> Class.forName ("postgresql.Driver");  
>   
> Which the correct form would be to be able to make it?

For 6.x drivers you are correct. For 7.x and later it's

  Class.forName("org.postgresql.Driver");

PS: For applications, you have two other methods available. One supplying
the driver in the command line, ie:

java -Djdbc.driver=org.postgresql.Driver my.application

The other is using Manifest in your application's jar file, which works
well under Windows.

Peter

-- 
Peter T Mount [EMAIL PROTECTED] http://www.retep.org.uk
PostgreSQL JDBC Driver http://www.retep.org.uk/postgres/
Java PDF Generator http://www.retep.org.uk/pdf/





[SQL] Table Attribute Help

2000-10-09 Thread Brian C. Doyle

Hello all,

I am trying to find a query to retrive the attributes of a table as in \d 
tablename but as a select command.  Is this possible?





Re: [SQL] Table Attribute Help

2000-10-09 Thread Jeff Hoffmann

"Brian C. Doyle" wrote:
> 
> Hello all,
> 
> I am trying to find a query to retrive the attributes of a table as in \d
> tablename but as a select command.  Is this possible?

run "psql -E" -- it will echo all of the sql queries that those commands
use.

-- 

Jeff Hoffmann
PropertyKey.com



Re: AW: [SQL] Table Attribute Help

2000-10-09 Thread Brian C. Doyle

That is great thank you.

How would I grab the attribute type for an attribute with it so that the 
out put would look like

   attname   atttype
--   --
  userid varchar(30)

I know that is not correct but is it possible to get that out put


At 05:27 PM 10/9/00 +0200, you wrote:
>yes it's possible,
>
>SELECT pg_attribute.attname
>FROM pg_class, pg_attribute
>WHERE
>pg_class.relname = 'xxx' and pg_attribute.attrelid = pg_class.oid
>
>and pg_attribute.attnum>=1 order by pg_attribute.attnum;
>
>xxx is your tablename!
>
>
>-Ursprüngliche Nachricht-
>Von: Brian C. Doyle [mailto:[EMAIL PROTECTED]]
>Gesendet: Montag, 9. Oktober 2000 17:21
>An: [EMAIL PROTECTED]
>Betreff: [SQL] Table Attribute Help
>
>
>Hello all,
>
>I am trying to find a query to retrive the attributes of a table as in \d
>tablename but as a select command.  Is this possible?




Re: [SQL] Table Attribute Help

2000-10-09 Thread omid omoomi


Hi,

>From: "Brian C. Doyle" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: [SQL] Table Attribute Help
>Date: Mon, 09 Oct 2000 11:21:21 -0400
>
>Hello all,
>
>I am trying to find a query to retrive the attributes of a table as in \d
>tablename but as a select command.  Is this possible?
>
>
yes. try to run psql with -E  and look at the related system tables when 
running \d command like (pg_class, pg_user, ...)
regards
Omid Omoomi
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.




Re: [SQL] OID Perfomance - Object-Relational databases

2000-10-09 Thread Josh Berkus

ruce,

> The oid counter is preserved with -o on reload. It is
> not reset.

I'll let you and Tom duke this one out. :-) It's all
beyond
me. 

> > 2. When OID's "wrap around" does the whole database
go
> > kablooie? If so, why hasn't it happened to anyone
yet?
> If
> > not, can you describe the system PGSQL uses to
allocate
> OIDs
> > once it gets to 2,147,xxx,xxx?
> 
> oid's start getting re-used on wraparound.
> 

This is what I mean. Does the DB engine only recycle
*unused* OIDs (that is, does it check for teh continued
existance of a tuple with OID 198401)? If that's the
method, then there isn't really a problem even if I do
use
OIDs as a primary index. None of my OIDs still in use
will
be touched.

If OIDs start getting re-used regardless if they are
already
present, then, like Tom says, it's Ragnarok. But it
seems
like somebody would have increased the OID to INT8 if
that
were a prospect.

-Josh Berkus

P.S. Bruce, I'm sorry about not sending my comments on
your
book. Do you have any use for copy-editing comments from
the June 28th version, or are you already in pre-press?



Re: [SQL] OID Perfomance - Object-Relational databases

2000-10-09 Thread Josh Berkus

Bruce, Tom, etc.:

> > This is what I mean.  Does the DB engine only recycle
> > *unused* OIDs (that is, does it check for teh continued
> > existance of a tuple with OID 198401)?  If that's the
> > method, then there isn't really a problem even if I do
> use
> > OIDs as a primary index.  None of my OIDs still in use
> will
> > be touched.
> 
> 
> No, it uses all oids, and can create duplicates.

Does this mean that Tom's "Wraparound Ragnarok" is the
accurate scenario?

-Josh Berkus



Re: [SQL] OID Perfomance - Object-Relational databases

2000-10-09 Thread Bruce Momjian

[ Charset ISO-8859-1 unsupported, converting... ]
> Bruce, Tom, etc.:
> 
> > > This is what I mean.  Does the DB engine only recycle
> > > *unused* OIDs (that is, does it check for teh continued
> > > existance of a tuple with OID 198401)?  If that's the
> > > method, then there isn't really a problem even if I do
> > use
> > > OIDs as a primary index.  None of my OIDs still in use
> > will
> > > be touched.
> > 
> > 
> > No, it uses all oids, and can create duplicates.
> 
> Does this mean that Tom's "Wraparound Ragnarok" is the
> accurate scenario?

Yes.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [SQL] Q: spinlock on Alpha? (PG7.0.2)

2000-10-09 Thread Fabrice Scemama

Try this:
http://www.rkirkpat.net/software/

Emils Klotins wrote:
> 
> RedHat Linux 6.2 on Alphaserver DS10 (egcs-1.1.2, glibc-2.1.3,
> libstdc++-2.9.0).
> Postgresql-7.0.2 source
> 
> Compiles and installs just fine. However, both the regular initdb and
> parallel regression testing's initdb stage fails with a core file and
> message:
> 
> FATAL: s_lock (2030d360) at spin.c:116, stuck spinlock. Aborting.
> FATAL: s_lock (2030d360) at spin.c:116, stuck spinlock. Aborting.
> 
> I fished around in the mailing lists and as I understand there has
> been some problems with spinlock on Alpha, which have been
> resolved?
> 
> Any ideas what could I check/do about that greatly appreciated (
> especially as I need to move the production server to alpha ASAP
> :(( )!
> 
> TIA,
> Emils



Re: [SQL] OID Perfomance - Object-Relational databases

2000-10-09 Thread Josh Berkus

Tom, Bruce,

Thanks.  I think that gives me a pretty clear picture.  How can we
submit this whole OID thing to the PGSQL FAQ?  Want me to write it up?

-Josh Berkus

P.S. BTW, my conclusion based on this discussion is that I will not use
the OIDs for indexing/linking.  Instead, I will embrace Michael's
earlier suggestion and have already created universal_sq and started
migrating primary keys to that sequence.  

P.P.S. Thank you both for taking the time to hash out this issue.


-- 
__AGLIO DATABASE SOLUTIONS___
Josh Berkus
   Complete information technology  [EMAIL PROTECTED]
and data management solutions   (415) 436-9166
   for law firms, small businesses   fax  436-0137
and non-profit organizations.   pager 338-4078
San Francisco



[SQL] RE: [HACKERS] foreign key introduces unnecessary locking ?

2000-10-09 Thread Mikheev, Vadim

Try this for both FK tables:

create table tmp2(idx2 int4, col2 int4, constraint
tmpcon2 foreign key(col2) references tmp1(idx) INITIALLY DEFERRED);

This will defer constraint checks till transaction commit...
though constraint triggers should use SnapshotDirty instead of
SELECT FOR UPDATE anyway.

Did you consider this, Jan?

Vadim

> When two tables (table2 and table3) have foreign keys
> referring to a common table(table1), I am unable to
> have 2 concurrent transactions - one performing insert
> on table1 and the other on table2, when the records
> being inserted have the same foreign key. 
> 
> If I use JDBC, one of the transactions aborts.
> If I open 2 psql sessions and try the same, one just
> waits and does not show the prompt until the other
> transaction has been committed or aborted.
> 
> For example,
> create table tmp1(idx int4, data int4);
> create table tmp2(idx2 int4, col2 int4, constraint
> tmpcon2 foreign key(col2) references tmp1(idx));
> create table tmp3(idx3 int4, col3 int4, constraint
> tmpcon3 foreign key(col3) references tmp1(idx));
> insert into tmp1 values(1, 1);
> 
> Transaction 1 :
> begin work;
> insert into tmp2 values(2, 1);
> 
> Transaction2 :
> begin work;
> insert into tmp3 values(3,1);
> 
> Since such transactions are common for me, for the
> time-being I have dropped the foreign key constraint.
> Any ideas ?
> 
> Rini
> 
> __
> Do You Yahoo!?
> Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!
> http://photos.yahoo.com/
> 



[SQL] Re: [HACKERS] foreign key introduces unnecessary locking ?

2000-10-09 Thread Stephan Szabo

On Mon, 2 Oct 2000, Rini Dutta wrote:

> When two tables (table2 and table3) have foreign keys
> referring to a common table(table1), I am unable to
> have 2 concurrent transactions - one performing insert
> on table1 and the other on table2, when the records
> being inserted have the same foreign key. 
> 
> If I use JDBC, one of the transactions aborts.
> If I open 2 psql sessions and try the same, one just
> waits and does not show the prompt until the other
> transaction has been committed or aborted.
> 
> For example,
> create table tmp1(idx int4, data int4);
> create table tmp2(idx2 int4, col2 int4, constraint
> tmpcon2 foreign key(col2) references tmp1(idx));
> create table tmp3(idx3 int4, col3 int4, constraint
> tmpcon3 foreign key(col3) references tmp1(idx));
> insert into tmp1 values(1, 1);
> 
> Transaction 1 :
> begin work;
> insert into tmp2 values(2, 1);
> 
> Transaction2 :
> begin work;
> insert into tmp3 values(3,1);
> 
> Since such transactions are common for me, for the
> time-being I have dropped the foreign key constraint.
> Any ideas ?

Each is attempting to grab row locks on tmp1 to prevent 
the rows from going away while we're testing the 
references. The second transaction is waiting for the row 
lock to go away so that it can do its row lock.
I'm not sure why its failing in JDBC though.





Re: [SQL] OID Perfomance - Object-Relational databases

2000-10-09 Thread Bruce Momjian

There is an FAQ item about oid's already on the web site.  It may not
be in 7.0.2.

> Tom, Bruce,
> 
>   Thanks.  I think that gives me a pretty clear picture.  How can we
> submit this whole OID thing to the PGSQL FAQ?  Want me to write it up?
> 
>   -Josh Berkus
> 
> P.S. BTW, my conclusion based on this discussion is that I will not use
> the OIDs for indexing/linking.  Instead, I will embrace Michael's
> earlier suggestion and have already created universal_sq and started
> migrating primary keys to that sequence.  
> 
> P.P.S. Thank you both for taking the time to hash out this issue.
> 
> 
> -- 
> __AGLIO DATABASE SOLUTIONS___
> Josh Berkus
>Complete information technology  [EMAIL PROTECTED]
> and data management solutions   (415) 436-9166
>for law firms, small businesses   fax  436-0137
> and non-profit organizations.   pager 338-4078
>   San Francisco
> 


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



[SQL] -query sql

2000-10-09 Thread Nema, Vivek

Hi!
   a small query may be u can help me.
 i just wanted to compare 2 columns in 2 tables.how can i do it in sql
statement.i know it is possible somehow i am not able to write my query.
i am using RDB 6.0

Any pointer or help will be highly appreciated.

Thanx
-vivek



[SQL] "Delete before" in ms sql?

2000-10-09 Thread Lars Vadsholt

Hi. Sorry for the newbie question. Does MS SQL have something like a "before
delete" when using a trigger?

best regards
Lars





Re: [SQL] "Delete before" in ms sql?

2000-10-09 Thread Josh Berkus

Mr. Vadsholt,

This is a Postgre-SQL list.  If you are using Microsoft SQL Server you
should proceed to http://msdn.microsoft.com/

-Josh Berkus
-- 
__AGLIO DATABASE SOLUTIONS___
Josh Berkus
   Complete information technology  [EMAIL PROTECTED]
and data management solutions   (415) 436-9166
   for law firms, small businesses   fax  436-0137
and non-profit organizations.   pager 338-4078
San Francisco



Re: [SQL] -query sql

2000-10-09 Thread John McKown

On Tue, 3 Oct 2000, Nema, Vivek wrote:

> Hi!
>a small query may be u can help me.
>  i just wanted to compare 2 columns in 2 tables.how can i do it in sql
> statement.i know it is possible somehow i am not able to write my query.
> i am using RDB 6.0
> 
> Any pointer or help will be highly appreciated.
> 

What is RDB? This list is for PostgreSQL. However, in general, suppose you
have column1 in table1 and column2 in table2, you can select rows where
they are equal by doing something like:

SELECT table1.column1, table1.another, table2.thisone,
FROM table1, table2
WHERE table1.column1=table2.column2;

Change the information you want in the first line of the SELECT. I just
made up some names.

Hope this helps,
John