Re: [SQL] Re: Get the tables names?

2001-07-23 Thread Stephan Szabo
On Mon, 23 Jul 2001, dado feigenblatt wrote: > > system tables all ~ '^pg', which is probably a better check than > > user=postgresql. > > You never know when someone will name their tables starting with "pg". > Well, you never know when someone will create their tables as user postgres > eithe

[SQL] Determining if two subnets intersect

2001-07-23 Thread Florian Weimer
Is there some efficient PostgreSQL expression which is true if and only if two subnets (given as values of type cidr) have non-empty intersection (even if the intersection is not a CIDR network)? -- Florian Weimer[EMAIL PROTECTED] University of Stuttgart http://cert

Re: [SQL] position(text,text) function

2001-07-23 Thread omid omoomi
position ( 'el' in 'hello') ; >From: [EMAIL PROTECTED] (Karl Orbell) >To: [EMAIL PROTECTED] >Subject: [SQL] position(text,text) function >Date: Mon, 23 Jul 2001 14:27:15 + (UTC) > >I'm having trouble using the position function, it's a simple built-in >function. > >It returns the index of a

Re: [SQL] unique index on more than one field using functions

2001-07-23 Thread Stephan Szabo
On 22 Jul 2001, Domingo Alvarez Duarte wrote: > I'm trying create a unique index using more than one field and > applying a function in one field to achieve case insensitive > uniqueness but postgresql doesn't accept. > > create table a( > > id int primary key, > id2 int not null, > na

Re: [SQL] RE: position(text,text) function

2001-07-23 Thread Josh Berkus
Jeff, Karl, Actually, he's confusing 3 functions. See postgresql.org --> user lounge --> interactive docs --> functions and operators --> string functions. -Josh > You are confusing the syntax of two similar functions: > position ('substring' in 'string') > strpos ('string', 'substring'). > I

Re: [SQL] position(text,text) function

2001-07-23 Thread Dorin Grunberg
The correct way would be: select position('el' in 'Hello'); Dorin At 02:27 PM 7/23/01 +, Karl Orbell wrote: I'm having trouble using the position function, it's a simple built-in function. It returns the index of a substring within a main string. But, I just can't get it to work, it alway

Re: [SQL] Full-text Indexing and Primary Keys

2001-07-23 Thread Chris Ruprecht
Josh, Full Text Indexing It will allow you to store text into a database and find portions of this text again, based on a few words of the text in the record. Say, for example, you want to store the bible in a PostGres database. You will store these fields: 1. Book 2. Chapter 3. Verse 4. Verse t

[SQL] RE: position(text,text) function

2001-07-23 Thread Jeff Eckermann
You are confusing the syntax of two similar functions: position ('substring' in 'string') strpos ('string', 'substring'). I have a feeling that "position" actually calls "strpos", but I am guessing on that. > -Original Message- > From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] > Sent: Mo

Re: [SQL] Full-text Indexing and Primary Keys

2001-07-23 Thread Giles Lean
Josh Berkus wrote: > 1. Can anyone explain to me what "full-text indexing" is, and why we do > or don't need it for Postgres? The marketing types keep asking me about > it ("buzzword o' the day") and I don't have an answer for them. Full text indexing: something like google does for HTML pages

Re: [SQL] Re: Records exactly the same.

2001-07-23 Thread Josh Berkus
Fons, > Well, I started with "I'm a beginner". But I'm sure there's no reason > NOT to > accept two records that are exactly the same. In the example I gave, > it is clear > that the information I want to store can contain two records that are > exactly > the same; doing the same thing, on the sa

[SQL] Full-text Indexing and Primary Keys

2001-07-23 Thread Josh Berkus
Folks, 1. Can anyone explain to me what "full-text indexing" is, and why we do or don't need it for Postgres? The marketing types keep asking me about it ("buzzword o' the day") and I don't have an answer for them. 2. I propose that future versions of PostgreSQL require a primary key at table c

[SQL] position(text,text) function

2001-07-23 Thread Karl Orbell
I'm having trouble using the position function, it's a simple built-in function. It returns the index of a substring within a main string. But, I just can't get it to work, it always gives this silly parser error. I've tried it in a variety of ways with variables instead of constants casting to

[SQL] RE: Records exactly the same.

2001-07-23 Thread Jeff Eckermann
The content of your record is not limited to user data. Including a field that provides a unique key is simple: look at the documentation for data type SERIAL for an easy way to do this. You can also include information about when the record was inserted, and by whom, just by including fields in

Re: [SQL] Re: PLpgSQL

2001-07-23 Thread Jan Wieck
Josh Berkus wrote: > Dado, > > > But still, the $1 is still plaguing me. > > > > Here's your problem: > > > >>CREATE FUNCTION new_proj_pts_seq(int4) > > >>RETURNS text > > >>AS 'DECLARE > > >>proj_ID alias for $1; > > >>seq_name TEXT; > > >>BEGIN > > >>seq_name := '

Re: [SQL] Possible problems with cyclic references

2001-07-23 Thread Gary Stainburn
Hi Jan, Thanks for the additional info. I did, having already posted the msg, tru to create the references, but found that it would not let me do that as I was trying to create a reference to a table that didn't exist yet. I ended up setting up a one-way reference, running pg_dump to see how

Re: [SQL] Re: Records exactly the same.

2001-07-23 Thread Richard Huxton
"Fons Rave" <[EMAIL PROTECTED]> wrote in message 9jbrpj$r67$[EMAIL PROTECTED]">news:9jbrpj$r67$[EMAIL PROTECTED]... > > Well, there isn't an easy answer for you ... because you've designed > > your database wrong. Records should *never* be the same. That is, ni > > fact, one of the cardinal rule

[SQL] how can we get total records in pg server?

2001-07-23 Thread Bhuvan A
Hi all, how can we get the COUNT of total records in the db server? hope this could be simple for pg experts. thankx in advance! Regards, Bhuvaneswar. Eighty percent of married men cheat in America. The rest

[SQL] Searching multiple fields from multiple tables

2001-07-23 Thread A. Mannisto
Hi, I should make search engine for psql environment. I works so that user sets search criterias (multiple words) and gets answers (like google does). Let say that I have one common key (primary) which is used as foreign key in rest of the tables. So I have many one_to_many relations. In thi

[SQL] Re: Records exactly the same.

2001-07-23 Thread Fons Rave
> Well, there isn't an easy answer for you ... because you've designed > your database wrong. Records should *never* be the same. That is, ni > fact, one of the cardinal rules of Relational Database Design. Well, I started with "I'm a beginner". But I'm sure there's no reason NOT to accept two

[SQL] Re: Get the tables names?

2001-07-23 Thread Magnus Landahl
Hi Everybody!! Well I tried this (below) and it workt perfectly. Thanks a lot for ALL answers to my question! >select tablename from pg_tables where tablename not like 'pg_%'; Kind regards, Magnus Landahl "Joel Burton" <[EMAIL PROTECTED]> skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PR

Re: [SQL] Possible problems with cyclic references

2001-07-23 Thread Jan Wieck
Gary Stainburn wrote: > Hi all, me again. > > I've been looking at the doc's again (must stop doing that!) > > I've been looking at the 'references' clause to implement referential > integrity. My problem is that I'm wanting to create a cyclic reference, and > was wondering what problems this may

[SQL] unique index on more than one field using functions

2001-07-23 Thread Domingo Alvarez Duarte
I'm trying create a unique index using more than one field and applying a function in one field to achieve case insensitive uniqueness but postgresql doesn't accept. create table a( id int primary key, id2 int not null, name varchar(50), unique(id2, lower(name)) ); Anyone have an i

[SQL] Procedures in views

2001-07-23 Thread Morgan Curley
Does anyone know if the following is possible: Table A has a list of names with a column entry containing the name of an assoc pl/pgsql function Table B has a list of values Table C is a junction table btw A and B I would like to create a view that returns info from both tables and does a calc

[SQL] Possible problems with cyclic references

2001-07-23 Thread Gary Stainburn
Hi all, me again. I've been looking at the doc's again (must stop doing that!) I've been looking at the 'references' clause to implement referential integrity. My problem is that I'm wanting to create a cyclic reference, and was wondering what problems this may cause, e.g. when restoring from

Re: [SQL] where'd the spaces come from

2001-07-23 Thread Richard Huxton
From: "Gary Stainburn" <[EMAIL PROTECTED]> > psql -c "select t.tregion || '/' || to_char(t.tnumber,'000') || '-' || > to_char(m.mnumber,'00') as unitno from teams t, members m > where m.mteam = t.tid;" >unitno > - > SW/ 041- 03 > SW/ 041- 05 Looks like a buglet in to_char()s ha

Re: [SQL] where'd the spaces come from

2001-07-23 Thread Gary Stainburn
Hi all, forget it, I've solved it. I converted the calls to: to_char(t.tnumber,'FM000') and it worked. Gary On Monday 23 July 2001 10:18 am, Gary Stainburn wrote: > Hi all, > > Can someone please explain how to remove the spaces from the results of the > query below. The current output is al

[SQL] where'd the spaces come from

2001-07-23 Thread Gary Stainburn
Hi all, Can someone please explain how to remove the spaces from the results of the query below. The current output is also included. What I want out of the query is something like 'NE/027-05'. psql -c "select t.tregion || '/' || to_char(t.tnumber,'000') || '-' || to_char(m.mnumber,'00') as