Re: [SQL] working with schema

2004-05-12 Thread William Anthony Lim
There is something still annoying me Scott.. eg: I want to have function that take a string argument that indicates which schema i want to use. create function testf(varchar) returns ... .. .. .. .. My question is how to use the argument in the function, maybe looks like: select * from $1.test

[SQL] Index not used - now me

2004-05-12 Thread Christoph Haller
I know there have been dozens of threads on this subject and I have searched the archives well (I hope at least), but still ... I have select version(); version -- PostgreSQL 7.3.4 on hppa-hp-hpux10.20, comp

Re: [ADMIN] [SQL] \set

2004-05-12 Thread Jie Liang
Thank you, Tom. Jie -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 12, 2004 4:06 PM To: Jie Liang Cc: Christian Kratzer; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [ADMIN] [SQL] \set "Jie Liang" <[EMAIL PROTECTED]> writes: > You will see AAA as

Re: [ADMIN] [SQL] \set

2004-05-12 Thread Tom Lane
"Jie Liang" <[EMAIL PROTECTED]> writes: > You will see AAA associate with 'whatever', it's an internal variable, > but how could I use it in my SQL query? regression=# \set AAA 'whatever' regression=# select :AAA; ERROR: column "whatever" does not exist regression=# \set AAA '\'whatever\'' regres

Re: [SQL] \set

2004-05-12 Thread Jie Liang
I am not talking about SET, I am talking about \set command. Yes, I understand, plpgsql can work around it, but I think postgresql should have a simple way to do it. E.g. Db>\set AAA 'whatever' Db>\set You will see AAA associate with 'whatever', it's an internal variable, but how could I use it in

Re: [SQL] How do i extract a certain bit from a bigint column

2004-05-12 Thread Bruno Wolff III
On Wed, May 12, 2004 at 08:17:39 -0400, Mike Rylander <[EMAIL PROTECTED]> wrote: > > The easiest way is to test for a bit using bitwise and: > > SELECT * FROM table WHERE (status & 2::BIGINT) <> 0 AND (status & 8::BIGINT) = > 0; The following will probably be a bit faster: SELECT * FROM table

[SQL] where is this problem (trigger)

2004-05-12 Thread Theodore Petrosky
I fire this trigger whenever my client updates a row in the db: CREATE FUNCTION notify_jobinfo() RETURNS "trigger" AS ' BEGIN EXECUTE ''NOTIFY ''||TG_RELNAME||''_''||NEW.jobnumber; RETURN NEW; END ' LANGUAGE plpgsql; CREATE TRIGGER notify_jobinfo AFTER UPDATE ON jobinfo FOR EACH R

solved Re: [SQL] view problem - too many rows out

2004-05-12 Thread Gary Stainburn
On Wednesday 12 May 2004 11:02 am, Gary Stainburn wrote: > Hi folks. > [snip] > create view order_summary as > select > c.cs_id, cs.count as qty, c.cs_make, c.cs_code, c.cs_type, > cst.cst_desc, c.cs_colour, > o.or_id, > o.or_supp, o.or_date, o.or_received, o.or_no, orst.orst_de

Re: [SQL] working with schema

2004-05-12 Thread scott.marlowe
On Wed, 12 May 2004, William Anthony Lim wrote: > Christoph, > > First, is it safe for multi user? I mean maybe first user need working with D200402, > second one need with D200403, if I do this in first user connection: > > SET search_path to D200402 ; > > does it affect to the second user s

Re: [SQL] How do i extract a certain bit from a bigint column

2004-05-12 Thread Tom Lane
=?iso-8859-1?Q?Mats_Sj=F6berg?= <[EMAIL PROTECTED]> writes: > What is the syntax to extract those bits? At least in 7.4, you can do it the same way you'd do it in C: regression=# select ((47::bigint) >> 3) & 1; ?column? -- 1 (1 row) I'm not sure when the bigint >> and & operato

Re: [SQL] How do i extract a certain bit from a bigint column

2004-05-12 Thread Mike Rylander
On Wednesday 12 May 2004 07:05 am, Mats Sjöberg wrote: > Hello everyone > In a table i have a column status of type bigint. > I need to create a view of the table including all rows with bit 4 set > (value 8). > At the same time i need to exclude excludig all rows with bit 2 set. > > What is the sy

[SQL] How do i extract a certain bit from a bigint column

2004-05-12 Thread Mats Sjöberg
Hello everyone In a table i have a column status of type bigint. I need to create a view of the table including all rows with bit 4 set (value 8). At the same time i need to exclude excludig all rows with bit 2 set.   What is the syntax to extract those bits? I have tested get_bit(str

Re: [SQL] working with schema

2004-05-12 Thread William Anthony Lim
Christoph, First, is it safe for multi user? I mean maybe first user need working with D200402, second one need with D200403, if I do this in first user connection: SET search_path to D200402 ; does it affect to the second user search path? Second, I want it dinamic. So, if I want to using D2

[SQL] view problem - too many rows out

2004-05-12 Thread Gary Stainburn
Hi folks. I've got a database for my consumable stock. I have a consumables table containing the type details, e.g. HP 4100 toner. I then have a cons_stock table holding item details, one record per item (2 toners = 2 rows). I have a order_dets view which pulls in all the data required inclu