Re: [HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-29 Thread Philip Warner
At 13:16 30/03/01 +0900, Hiroshi Inoue wrote: >Philip Warner wrote: >> >> At 19:14 29/03/01 -0800, Mikheev, Vadim wrote: >> >> >Reported problem is caused by bug (only one tuple version must be >> >> >returned by SELECT) and this is way to fix it. >> >> > >> >> >> >> I assume this is not possible

Re: [HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-29 Thread Tom Lane
> Just looked in heapam.c - I can fix it in two hours. > The question is - should we do this now? This scares the hell out of me. I do NOT think we should be making quick-hack changes in fundamental system semantics at this point of the release cycle. The problem went unnoticed for two full rel

RE: [HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-29 Thread Philip Warner
At 19:14 29/03/01 -0800, Mikheev, Vadim wrote: >> >Reported problem is caused by bug (only one tuple version must be >> >returned by SELECT) and this is way to fix it. >> > >> >> I assume this is not possible in 7.1? > >Just looked in heapam.c - I can fix it in two hours. >The question is - shoul

Re: [HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-29 Thread Hiroshi Inoue
Philip Warner wrote: > > At 19:14 29/03/01 -0800, Mikheev, Vadim wrote: > >> >Reported problem is caused by bug (only one tuple version must be > >> >returned by SELECT) and this is way to fix it. > >> > > >> > >> I assume this is not possible in 7.1? > > > >Just looked in heapam.c - I can fix it

RE: [HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-29 Thread Philip Warner
At 09:58 28/03/01 -0800, Mikheev, Vadim wrote: > >Reported problem is caused by bug (only one tuple version must be >returned by SELECT) and this is way to fix it. > I assume this is not possible in 7.1? Philip Warner

[SQL]

2001-03-29 Thread Md. Intekhab Alam
Has anyone tried setting up Postgres as a linked server under Microsofts SQL Server 7 to connect with SQL 6.5 I am able to create the link correctly (see below) and see all the tables available in Postgres, but if I try querying anything in them I get the following error Server: Msg 7313, Level

[SQL] date_part bug?

2001-03-29 Thread Salvador Mainé
Hello: I'm using postgres 7.0.2. When I use date_part('day', date) sometimes I get wrong values. Ie: and date_part('day', '1999-3-28')=27 and date_part('day', '2000-3-26')=25 Is it a bug? Is there any SQL equivalent function? -- Salvador Mainé ---(end of broadcast)--

RE: [HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-29 Thread Mikheev, Vadim
> > I don't think that we dare try to make any basic changes in > > MVCC for 7.1 at this late hour, so Forest is going to have > > to live with that answer for awhile. But I would like to see > > a cleaner answer in future releases. > > Is it the MVCC's restriction that each query inside a functi

[SQL] pg_dump error plus RelationBuildTriggers: 1 record(s) not found for rel links

2001-03-29 Thread Najm Hashmi
Hi all, here is error I that am getting: pg_dump -s mondo > mondo.out PQgetvalue: ERROR! tuple number 0 is out of range 0..-1 I faced similar example in the past too. At that time, there was a referentional constraint problem but this situation is different. I am usning postgres 7.0.3 on redh

Re: [SQL] Escaping \

2001-03-29 Thread Cedar Cox
> > I've a problem with escaping a \ in a string. > > > > When I enter the query: > > > > SELECT '''\\\''; I get the right result: '\' > > > > But when I try this in a Function: > > > > CREATE FUNCTION sp_tmp() RETURNS varchar(10) > > AS ' > > SELECT ''\\\' AS RESULT' > > LANGUAGE 'sql';

[SQL] Possible 7.1RC1 bug

2001-03-29 Thread Kyle
Here's a fragment of code that works on 7.0.3 but gives a type mismatch on 7.1: Under 7.1RC1, func1 fails and func2 builds OK.  The error is: ERROR:  return type mismatch in function: declared to return int4, returns numeric It appears that sum(int4) returns type numeric.  Shouldn't it return int

Re: Calling Java from psql (was Re: [SQL] requesting help)

2001-03-29 Thread Peter Eisentraut
Tom Lane writes: > I'm generally pretty suspicious of any system design that requires > calling outside programs from an SQL function. The problem is that > this fundamentally breaks transactional semantics: if the transaction > is rolled back after the function call, its effects inside the data

[SQL] RE: serial type; race conditions

2001-03-29 Thread Jeff Eckermann
Probably just me: but I don't see the point. Consider: * User 1 commences insert transaction: grabs nextval(sequence), max(foo) * User 2 commences insert transaction: grabs nextval(sequence), max(foo) * User 1 commits * User 2 commits (insert has sequence value one higher

[SQL] Update taking forever

2001-03-29 Thread Graham Vickrage
I am trying to do an update on column in a table with 1.5 millions rows. The SQL is as follows, I am also putting it in a transaction in case things go wrong. begin; update statistics set parameters = NULL where parameters =''; An explain produces the following: - Seq Scan on statistics (cost=

Re: Calling Java from psql (was Re: [SQL] requesting help)

2001-03-29 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > A James Lewis writes: >> Before I go investigating this, is it possible to trigger an arbitrary >> program from the SQL, say a shell script? > At the lowest level, you can generally do anything a C program can do. > Writing the equivalent of system()

[GENERAL] Re: [SQL] inconsistent functionality with LIKE operator

2001-03-29 Thread Tom Lane
Phuong Ma <[EMAIL PROTECTED]> writes: > I'm using PostgreSQL version 7.1, and I'm having trouble with the LIKE > statement. How would I find the value "a\bc"? I tried using the > backslash to escape it: LIKE 'a\\b%'; I think you need four backslashes. The string-literal parser eats one level o

Re: Calling Java from psql (was Re: [SQL] requesting help)

2001-03-29 Thread Peter Eisentraut
A James Lewis writes: > Before I go investigating this, is it possible to trigger an arbitrary > program from the SQL, say a shell script? At the lowest level, you can generally do anything a C program can do. Writing the equivalent of system() in SQL should be rather trivial. You can also take

[SQL] inconsistent functionality with LIKE operator

2001-03-29 Thread Phuong Ma
I'm using PostgreSQL version 7.1, and I'm having trouble with the LIKE statement. How would I find the value "a\bc"? I tried using the backslash to escape it: LIKE 'a\\b%'; If I specify: LIKE 'a\\bc', then it works, but if I wanted it to look for consecetive characters after the c, using the %,

Re: [SQL] Escaping \

2001-03-29 Thread Tom Lane
"Martijn van Dijk" <[EMAIL PROTECTED]> writes: > But when I try this in a Function: > CREATE FUNCTION sp_tmp() RETURNS varchar(10) > AS ' > SELECT ''\\\' AS RESULT' > LANGUAGE 'sql'; > I get the following Parse-erros: You need an extra level of quoting because the function body is itsel

Re: Calling Java from psql (was Re: [SQL] requesting help)

2001-03-29 Thread clayton cottingham
Peter Mount wrote: > > At 10:33 26/03/01 +0200, Mathijs Brands wrote: > > >Has anybody ever tried calling Java code from a pgsql trigger written > >in C? Shouldn't this be possible using JNI? > > This was discussed recently. > > >I'm not exactly a Java expert myself, but this is the way PHP al

Re: [SQL] serial type; race conditions

2001-03-29 Thread Michael Fork
If you are looking to have every number accounted for, something like this will work: INSERT INTO table (serial_col) SELECT nextval('seq_serial_col'); UPDATE table SET foo = 'bar' , ... WHERE serial_col = (SELECT currval('seq_serial_col')); then, if the update fails, the number will be accounte

Re: [SQL] serial type; race conditions

2001-03-29 Thread Andrew Perrin
I ditto what Bruce said - trying to get a true sequence without gaps is a losing battle. Why don't you, instead, use a serial column as the real sequence, and then a trigger that simply inserts max(foo) + 1 in a different column? Then when you need to know the column, do something like: SELECT nu

Re: [SQL] serial type; race conditions

2001-03-29 Thread Bruce Momjian
> How does currval work if you are not inside a transaction. I have > been experimenting with inserting into a table that has a sequence. > If the insert fails (not using a transaction) because of bad client input > then the next insert gets the proper next number in the sequence. If you are i

Re: [SQL] serial type; race conditions

2001-03-29 Thread postgresql
How does currval work if you are not inside a transaction. I have been experimenting with inserting into a table that has a sequence. If the insert fails (not using a transaction) because of bad client input then the next insert gets the proper next number in the sequence. given sequence 1,2,3

Re: Calling Java from psql (was Re: [SQL] requesting help)

2001-03-29 Thread Mathijs Brands
On Thu, Mar 29, 2001 at 10:10:44AM +0100, Peter Mount allegedly wrote: > At 21:37 26/03/01 +0200, Mathijs Brands wrote: > >On Mon, Mar 26, 2001 at 07:00:43PM +0200, Peter Eisentraut allegedly wrote: > > > Mathijs Brands writes: > > > > > > > Has anybody ever tried calling Java code from a pgsql tr

Re: [SQL] Escaping \

2001-03-29 Thread Richard Huxton
From: "Martijn van Dijk" <[EMAIL PROTECTED]> > I've a problem with escaping a \ in a string. > > When I enter the query: > > SELECT '''\\\''; I get the right result: '\' > > But when I try this in a Function: > > CREATE FUNCTION sp_tmp() RETURNS varchar(10) > AS ' > SELECT ''\\\' AS RESUL

Re: [SQL] Function with now() | time 'now' | etc...

2001-03-29 Thread Cedar Cox
> [EMAIL PROTECTED] writes: > > It doesn't getting different times on each execution. I also tried put > > "timestamp 'now'" insted "now()". What am I doing wrong? > > now() is defined to return the time of the start of the current > transaction. It won't change value inside a transaction

Re: [SQL] Self-Referencing

2001-03-29 Thread Cedar Cox
On Wed, 28 Mar 2001, David Olbersen wrote: > Hello, > > I have a feeling this isn't going to make much sense, but I'm gonig to try > anyway. > > What I'd like to do is be able to refer to an outer-SELECT from an > inner-SELECT. I hope this makes sense. > > I need to be able to refer

Re: [SQL] SELECT ... FOR UPDATE

2001-03-29 Thread Cedar Cox
On Wed, 28 Mar 2001, Marcos Minshew wrote: > I am interested in using the SELECT ... FOR UPDATE feature but it doesn't > work quite the way I had hoped. If there is a better/different way of doing > this please enlighten me. > > If I issue: > > BEGIN; > SELECT * FROM atable WHERE atable.key

Re: Calling Java from psql (was Re: [SQL] requesting help)

2001-03-29 Thread Peter Mount
At 21:37 26/03/01 +0200, Mathijs Brands wrote: >On Mon, Mar 26, 2001 at 07:00:43PM +0200, Peter Eisentraut allegedly wrote: > > Mathijs Brands writes: > > > > > Has anybody ever tried calling Java code from a pgsql trigger written > > > in C? Shouldn't this be possible using JNI? > > > > I have, a

Re: Calling Java from psql (was Re: [SQL] requesting help)

2001-03-29 Thread Peter Mount
At 10:33 26/03/01 +0200, Mathijs Brands wrote: >Has anybody ever tried calling Java code from a pgsql trigger written >in C? Shouldn't this be possible using JNI? This was discussed recently. >I'm not exactly a Java expert myself, but this is the way PHP allows >you to call Java code from your

Re: [SQL] Self-Referencing

2001-03-29 Thread Christof Glaser
On Thursday, 29. March 2001 01:38, David Olbersen wrote: [snip] > SELECT > building_id, > num_buildings, > ( > SELECT count( building_id ) > FROM building_portals > WHERE building_id = THIS.building_id > ) > FROM buildings; Try this query (untested), using

[SQL] Escaping \

2001-03-29 Thread Martijn van Dijk
Hello all, I've a problem with escaping a \ in a string. When I enter the query: SELECT '''\\\''; I get the right result: '\' But when I try this in a Function: CREATE FUNCTION sp_tmp() RETURNS varchar(10) AS ' SELECT ''\\\' AS RESULT' LANGUAGE 'sql'; I get the following Parse-erros: