Re: [SQL] double linked list

2003-02-01 Thread --CELKO--
>> are you joe celko, guy who wrote those sql books? << Yes. ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mail

Re: [SQL] [NOVICE] For each record in SELECT

2003-02-01 Thread Andrew McMillan
On Sat, 2003-02-01 at 10:21, Luis Magaña wrote: > Hi, > > I have a question here: > > I have a table with this fields: > > month > description > amount > > now I have to write a query that retrieves the sum of the amount from > the minimum month to the maximum month registered for each diferen

[SQL] how do i create a date from a substring???

2003-02-01 Thread joe.guyot
greetings all! [i just became a member] i have a string data from a view that is a packed field. it contains a date, a time and a user's initials. i'm trying to extract the date portion in a pg 7 view. the data originally came from a ms sql 7 table that has since been converted into a pg 7 table

[SQL] Index File growing big.

2003-02-01 Thread PRAGATI SAVAIKAR
Hi !! We have "PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96" installed on Linux (RedHat 7.2) Our database size is 15 GB. Since the database size was increasing and was about to cross the actual Hard Disk parttion Size, we moved the datafiles (also the index files) to another p

Re: [SQL] double linked list

2003-02-01 Thread Ryan
are you joe celko, guy who wrote those sql books? "--CELKO--" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> The table at hand is more a kind of a collection of graphs where I > want to find all possible paths between a given starting point and a > given en

Re: [SQL] Filter function

2003-02-01 Thread Evgen Potemkin
it's base-7.3.1 from one of the russian mirrors. regards, --- .evgen On Wed, 29 Jan 2003, Tom Lane wrote: > Evgen Potemkin <[EMAIL PROTECTED]> writes: > > term2=>select * from tab where tab=1; > > ERROR: exprType: Do not know how to get type for 711 node > > What release is this? I get >

[SQL] how can i convert a substring to a date?

2003-02-01 Thread joe.guyot
greetings all! i have a string data from a view that is a packed field. it contains a date, a time and a user's initials. i'm trying to extract the date portion in a pg 7 view. the data originally came from a ms sql 7 table that has since been converted into a pg 7 table. in the ms sql 7 view th

[SQL] Help with a query for charting

2003-02-01 Thread Andrew Veitch
I'm trying to do a query to count the number of tickets opened on each day of a month. It'll always be from the 1st to the end of the month. This does it: SELECT TO_CHAR(DATE_TRUNC('day',date_opened),'DD') AS day, COUNT(*) FROM ticket GROUP BY DATE_TRUNC('day', date_opened) WHERE ; But it

Re: [SQL] double linked list

2003-02-01 Thread Juergen
heavy stuff Celko. I would lie if I would pretend I fully understand Your answer. I'll let sink it in. However, I dont store a consistent tree structure. The table at hand is more a kind of a collection of graphs where I want to find all possible paths between a given starting point and a given en

Re: [SQL] double linked list

2003-02-01 Thread Jan Hidders
Juergen wrote: > >However, I dont store a consistent tree structure. The table at hand >is more a kind of a collection of graphs where I want to find all >possible paths between a given starting point and a given end point A collection of graphs? As you presented the problem it was simply a single

[SQL] COPY use in function with variable file name

2003-02-01 Thread Sondaar Roelof
Hello, I can't figure out how to make this work, or is not possible? In a function i would like to read a file. The file name is determined by a value from a table. However the COPY statement does not to accept this? I tried various forms of adding (single)-quotes but no luck. Anyone any ideas?

Re: [SQL] double linked list

2003-02-01 Thread --CELKO--
>> The table at hand is more a kind of a collection of graphs where I want to find all possible paths between a given starting point and a given end point. << For the reachabiity index of a general graph, you need Warshal's algorithm. Let V = number of nodes in the graph Let A[i,j] be the adjacen

Re: [SQL] Creating tables from within functions

2003-02-01 Thread Sondaar Roelof
Hello, Try this: CREATE FUNCTION _testcreate () RETURNS text AS ' BEGIN CREATE TABLE switch_table2 (switch_id varchar(32), selection_name varchar(100)); RETURN ''true''; END; ' language 'plpgsql'; SELECT _testcreate(); Result: snlsor=# SELECT _testcreate(); _testcreate -

[SQL] returning table from a function

2003-02-01 Thread Seethalakshmi VB
Hi How to return a user created table from a function?  

[SQL] extracting constraints from schema

2003-02-01 Thread Agnieszka Rutkowska
Hi, I was just wondering whether you happen to know how to extract what the table and column constraints are using jdbc? The API provides methods for extracting meta data on the table names, column names, primary and foreigh keys as well as column types and sizes. What about extracting constraints

Re: [SQL] Controlling access to Sequences

2003-02-01 Thread Ross J. Reedstrom
On Sat, Feb 01, 2003 at 12:39:50AM -0600, Bruno Wolff III wrote: > On Fri, Jan 31, 2003 at 23:47:27 +1100, > Matthew Horoschun <[EMAIL PROTECTED]> wrote: > > > > Is there any effective method for controlling access to a SEQUENCE? or > > should I do something like in the view: > > You can limit

Re: [SQL] update and IN vs. EXISTS

2003-02-01 Thread pginfo
Bruno Wolff III wrote: > On Sat, Feb 01, 2003 at 12:40:00 +0100, > pginfo <[EMAIL PROTECTED]> wrote: > > > > If I try to execute: > >update Table1 set fieldForUpdate = 1 where ID IN (select T2.ID from > > Table2); > > it is running very slow. > > You might try: > update Table1 set fieldF

Re: [SQL] update and IN vs. EXISTS

2003-02-01 Thread Bruno Wolff III
On Sat, Feb 01, 2003 at 12:40:00 +0100, pginfo <[EMAIL PROTECTED]> wrote: > > If I try to execute: >update Table1 set fieldForUpdate = 1 where ID IN (select T2.ID from > Table2); > it is running very slow. You might try: update Table1 set fieldForUpdate = 1 from Table2 where Table1.id = T

Re: [SQL] vacuum and serial primary keys

2003-02-01 Thread D'Arcy J.M. Cain
On Saturday 01 February 2003 07:45, Carmen Marincu wrote: > I am using Postgresql 7.1.3 and I have deleted 3000 rows from a table > (with DELETE). > Than I used vacuum to actually delete the rows markes as deleted > by the DELETE command.. > The trouble is that the "counter" for the serial primary

[SQL] vacuum and serial primary keys

2003-02-01 Thread Carmen Marincu
Hello - I am using Postgresql 7.1.3 and I have deleted 3000 rows from a table (with DELETE). Than I used vacuum to actually delete the rows markes as deleted by the DELETE command.. The trouble is that the "counter" for the serial primary key (ID field) wasn't reset. So now althought I have only

[SQL] update and IN vs. EXISTS

2003-02-01 Thread pginfo
Hi, I have 2 tables Table1 and Table2. The PK for Table1 is declared as name. Table 2 have only 1 field and it is also name ( it is indexed). I will to update all Table1.filedForUpdate for all rows that exists in Table2. In Table1 I have ~ 120 000 rows and in Table2 I have ~ 100 000. If I execu