[SQL] FATAL 2: PageIndexTupleDelete

2003-11-17 Thread cristi
salt=# vacuum full; FATAL 2: PageIndexTupleDelete: corrupted page pointers: lower = 12289, upper = 1, special = 60672 server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. A

[SQL] strange "not deferrable" behaviour

2003-11-17 Thread Tomasz Myrta
Hi I've got some tables defined as: create table xx ( some_column references master_table It means this column is defined by default: NOT DEFERRABLE, INITIALLY IMMEDIATE I tried replacing rows in this table by new ones as: set autocommit=off; begin; set constraints all deferred; delete from

Re: [SQL] Addition and subtraction on BIT type

2003-11-17 Thread Yasir Malik
Thank you for your reply. select int4(b'1001')::bit(32); gives the same result as what you gave. select int4(b'1001')::bit(4); gives the upper four bits, which are all zeroes. How would I get the lower four bits? I building bitmaps using plpgsql, and therefore, I will be doing a lot bit manipulat

Re: [SQL] strange "not deferrable" behaviour

2003-11-17 Thread Stephan Szabo
On Mon, 17 Nov 2003, Tomasz Myrta wrote: > I've got some tables defined as: > create table xx ( >some_column references master_table > > It means this column is defined by default: > NOT DEFERRABLE, INITIALLY IMMEDIATE > > I tried replacing rows in this table by new ones as: > set autocommit=

Re: [SQL] Addition and subtraction on BIT type

2003-11-17 Thread Stephan Szabo
On Mon, 17 Nov 2003, Yasir Malik wrote: > Thank you for your reply. > select int4(b'1001')::bit(32); gives the same result as what you gave. > select int4(b'1001')::bit(4); gives the upper four bits, which are all > zeroes. How would I get the lower four bits? I building bitmaps using > plpgsql,

Re: [SQL] strange "not deferrable" behaviour

2003-11-17 Thread Tomasz Myrta
Dnia 2003-11-17 16:16, Użytkownik Stephan Szabo napisał: Hmm, I'd suggest turning on query logging to make sure pgAdmin is doing what you expect. Well, I've already done this. I didn't check query log, but a result by selecting rows from modified table. Anyway I opened a pgAdmin log and didn't fi

[SQL] Multicolum index and primary key

2003-11-17 Thread Michele Bendazzoli
I wonder if is useless to set some indexes for columns contained in a multifield primary key. Suppose by example that one have a table1 with a primary key over three field (a, b, c): ALTER TABLE public.table1 ADD CONSTRAINT table1_pkey PRIMARY KEY(a, b, c); are the indexes over (a) and (a, b)

Re: [SQL] Multicolum index and primary key

2003-11-17 Thread Peter Eisentraut
Michele Bendazzoli writes: > ALTER TABLE public.table1 > ADD CONSTRAINT table1_pkey PRIMARY KEY(a, b, c); > > are the indexes over (a) and (a, b) redundant (and so useless)? Exactly. > p.s. I know, I'll have to begin to use the explain command ... > I promise I'll do it ;-) You could also hav

Re: [SQL] Multicolum index and primary key

2003-11-17 Thread Tomasz Myrta
Dnia 2003-11-17 18:00, Użytkownik Michele Bendazzoli napisał: p.s. I know, I'll have to begin to use the explain command ... I promise I'll do it ;-) Use the explain analyze command and then answer yourself ;-) Regards, Tomasz Myrta ---(end of broadcast)

Re: [SQL] Multicolum index and primary key

2003-11-17 Thread Rod Taylor
> Suppose by example that one have a table1 with a primary key over three > field (a, b, c): .. > are the indexes over (a) and (a, b) redundant (and so useless)? Yes, they are redundant not not necessarily useless. In short, an index with 3 keys will be larger than an index with 1 key, as such

Re: [SQL] Multicolum index and primary key

2003-11-17 Thread Michele Bendazzoli
On Mon, 2003-11-17 at 17:15, Tomasz Myrta wrote: > Dnia 2003-11-17 18:00, Użytkownik Michele Bendazzoli napisał: > > p.s. I know, I'll have to begin to use the explain command ... > > I promise I'll do it ;-) > > Use the explain analyze command and then answer yourself ;-) I'm not in still in pro

Re: [SQL] Multicolum index and primary key

2003-11-17 Thread Michele Bendazzoli
On Mon, 2003-11-17 at 17:14, Peter Eisentraut wrote: > Michele Bendazzoli writes: > > > ALTER TABLE public.table1 > > ADD CONSTRAINT table1_pkey PRIMARY KEY(a, b, c); > > > > are the indexes over (a) and (a, b) redundant (and so useless)? > > Exactly. > > p.s. I know, I'll have to begin to use

[SQL] COPY

2003-11-17 Thread ritchie turner
Hi all I'm trying to optimise some sql inserts I have by using the COPY command instead. I'm connecting from Java using 7.4 beta 3. It works at the command line, but I can't get it to work from Java. Here's the pg log output. LOG: query: COPY bingo_cards (account_id, game_id, win_ball, card,

Re: [SQL] Quota query with decent performance?

2003-11-17 Thread Troels Arvin
On Tue, 11 Nov 2003 18:49:31 -0500, Chester Kustarz wrote: [... discussion of top-n query (where n=3) ...] > select * > from person > where age <= > (select age from person order by age limit 1 offset 2); It fails when the cardinality of person is less than 3 (returns empty set). My solution is

Re: [SQL] FATAL 2: PageIndexTupleDelete

2003-11-17 Thread Gaetano Mendola
cristi wrote: salt=# vacuum full; FATAL 2: PageIndexTupleDelete: corrupted page pointers: lower = 12289, upper = 1, special = 60672 server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the se

Re: [SQL] Multicolum index and primary key

2003-11-17 Thread Michele Bendazzoli
On Mon, 2003-11-17 at 17:23, Rod Taylor wrote: > > Suppose by example that one have a table1 with a primary key over three > > field (a, b, c): > .. > > are the indexes over (a) and (a, b) redundant (and so useless)? > > Yes, they are redundant not not necessarily useless. > > In short, an index

[SQL] multiple function declarations

2003-11-17 Thread Majhi, Akas
Hi ,   I have a plpgsql function (MainFunc) that intends to reuse a a particular block of code. So, I intend to make that particulat block of code into another function. (say, HelperFunc)   My question is   1. Can I declare a function (HelperFunc) inside the main function  (MainFunc)   2. If

Re: [SQL] multiple function declarations

2003-11-17 Thread Peter Eisentraut
Majhi, Akas writes: > 1. Can I declare a function (HelperFunc) inside the main function (MainFunc) > 2. If yes then how. You could do it if you create the CREATE FUNCTION command in a string variable and then use EXECUTE to run it, but the normal way would be to declare it outside. There is usu