[SQL] where to start with this procedure ?

2004-05-19 Thread Andreas
Hi, I know a bit of SQL but not exactly a lot so I ran into this problem. I have tables on the server that get joined in a view. That's OK. Now I need just a couple of records say 10-100 of 30 000 which could easily be filtered by a integer key. As of now I have to pull the whole lot into Access a

Re: [SQL] rules

2004-05-19 Thread Stephan Szabo
On Wed, 19 May 2004, Jie Liang wrote: > According to the document of rule: > > CREATE RULE rulename AS ON delete TO mytablename DO > ( > delete from aaa where id=OLD.id; > Delete from bbb where id=OLD.id; > Delete from ccc where id=OLD.id > ); > > > Should work, but it doesn't, what wrong with it?

Re: [SQL] Function valid only for one table

2004-05-19 Thread Martin Knipper
Hi Tom, Am 19.05.2004 19:33 schrieb Tom Lane: > Martin Knipper <[EMAIL PROTECTED]> writes: > >>I thought about a mixture of object orientation and a normal table >>for a relational database. >>someFunction() is a method for the object/table someTable. > > Perhaps you could do what you want with

Re: [SQL] [ADMIN] rules

2004-05-19 Thread Jie Liang
Sorry, wrong question. -Original Message- From: Jie Liang Sent: Wednesday, May 19, 2004 10:20 AM To: Tom Lane Cc: postgres-list; [EMAIL PROTECTED] Subject: [ADMIN] rules According to the document of rule: CREATE RULE rulename AS ON delete TO mytablename DO ( delete from aaa where id=OL

Re: [SQL] Function valid only for one table

2004-05-19 Thread Tom Lane
Martin Knipper <[EMAIL PROTECTED]> writes: > I thought about a mixture of object orientation and a normal table > for a relational database. > someFunction() is a method for the object/table someTable. Perhaps you could do what you want with functions accepting table rowtypes. create func

[SQL] rules

2004-05-19 Thread Jie Liang
According to the document of rule: CREATE RULE rulename AS ON delete TO mytablename DO ( delete from aaa where id=OLD.id; Delete from bbb where id=OLD.id; Delete from ccc where id=OLD.id ); Should work, but it doesn't, what wrong with it? Even I use { } Jie Liang -

Re: [SQL] Function valid only for one table

2004-05-19 Thread Martin Knipper
Am 19.05.2004 18:33 schrieb Richard Huxton: > Martin Knipper wrote: > >>Hi there, >> >>is it possible to define a function that is only valid in a context >>of one table ? >> >>For Example: >> >>select someFunction() from someTable; >>-> OK >> >>select someFunction() from anotherTable; >>-> Error:

Re: [SQL] SCHEMA's the easy way?

2004-05-19 Thread Tom Lane
Chris Gamache <[EMAIL PROTECTED]> writes: > I'm planning on dipping my toes into the world of schemata. I have tables, > created in the Public schema, that I'd like to move to the new schema: > Is there an easier, faster, less user-error-prone way around this? pg_dump, edit the "set search_path"

[SQL] SCHEMA's the easy way?

2004-05-19 Thread Chris Gamache
I'm planning on dipping my toes into the world of schemata. I have tables, created in the Public schema, that I'd like to move to the new schema: SELECT * INTO new.tablename FROM public.tablename; CREATE SEQUENCE ...; CREATE INDEX ...; ALTER TABLE ...; BLAH ...; BLAH ...; BLAH ...; DROP public.tab

Re: [SQL] Function valid only for one table

2004-05-19 Thread Richard Huxton
Martin Knipper wrote: Hi there, is it possible to define a function that is only valid in a context of one table ? For Example: select someFunction() from someTable; -> OK select someFunction() from anotherTable; -> Error: someFunction unkown Um, no. What do you want someFunction() to do? -- Rich

[SQL] Function valid only for one table

2004-05-19 Thread Martin Knipper
Hi there, is it possible to define a function that is only valid in a context of one table ? For Example: select someFunction() from someTable; -> OK select someFunction() from anotherTable; -> Error: someFunction unkown Of course both tables are in the same database. Greetings, Martin -

Re: [SQL] Very slow search using basic pattern matching

2004-05-19 Thread Raphael A. Bauer
Dan Field wrote: Is there any documentation available on how to go about creating these indexes on my text fields? I'm at a bit of a loss here, Google is failing me sadly http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/ We made quite good experiences with tsearch2. The problem for you coul

Re: [SQL] Very slow search using basic pattern matching

2004-05-19 Thread Dan Field
On 18 May 2004, at 17:12, Bruno Wolff III wrote: On Tue, May 18, 2004 at 16:47:11 +0100, Dan Field <[EMAIL PROTECTED]> wrote: FROM da_records WHERE da_records.DESCRIPTION_CY ~* '.*Aberystwyth*.' OR da_records.TITLE_CY ~* '.*Aberystwyth*.' limit 100 Is there a better way o

Re: [SQL] a wierd query

2004-05-19 Thread Christoph Haller
> > select distinct on (date, employee_id) employee_id, date from > ( > select distinct on (begindate, employee_id) begindate as date, employ= > ee_id from workhour > UNION > select distinct on (enddate, employee_id) enddate as date, employee_i= > d from workhour > )a