[SQL] about cursor

2001-07-25 Thread frederic romagna
Hello, I am using posgresql 7.0 with apache 1.3.19, and redhat 7.1 I am writing SQL queries embedded in PHP language embedded in HTML, I would like to know if it is possible to declare a cursor for select, and to include an update in the queries contained in the Cursor, if not what are the possib

Re: [SQL] Meta integrity

2001-07-25 Thread Grigoriy G. Vovk
Yes, its not a task for _relation_ dbms. I am database developer, I like rdbms, but now I think that I should start to use LDAP for these kind of tasks. What people can say? Jul 25, 08:22 -0700, Josh Berkus wrote: > Renato, > > > ...will only guarantee that each attribute points to an existent >

Re: [SQL] Meta integrity

2001-07-25 Thread Stephan Szabo
On Wed, 25 Jul 2001, Renato De Giovanni wrote: > I'm working on a project based on an unusual data model. Some entities > aren't represented by separate tables, they're grouped in the same table > just like the following simplified model shows: > > CREATE TABLE class ( >id CHAR(8)

Re: [SQL] Re: Inserts in triggers Follow Up

2001-07-25 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: > That's because the SELECT INTO variable and SELECT INTO record syntax > are confusingly different. It's > for records: > SELECT INTO record_var * FROM ... > for simple variables: > SELECT column INTO variable FROM ... > I'm not clear on the origin of

Re: [SQL] Re: Inserts in triggers Follow Up

2001-07-25 Thread Josh Berkus
Tom, > No, this isn't right. If you check the source code you will discover > that plpgsql is extremely lax about the positioning of the INTO > clause, > and will in fact accept it almost anywhere. Datatype has nothing to > do with this. (It probably should be stricter, but at this point I > d

Re: [SQL] Meta integrity

2001-07-25 Thread Josh Berkus
Renato, > ...will only guarantee that each attribute points to an existent > object > but it will not care about the object's class. Question is: how could > I > also enforce this kind of "meta integrity"? The following table > definition came to my mind, but its an illegal construction: > > CRE

Re: [SQL] Re: Inserts in triggers Follow Up

2001-07-25 Thread Josh Berkus
Morgan, > One other problem I am having in that proc is SELECT'ing INTO a var. > > declare > id lookup_sports.sport_id%TYPE; > begin > SELECT INTO id sport_id FROM lookup_sports WHEREsome > clause > > id is always null That's because the SELECT INTO variable and SELECT IN

[SQL] Meta integrity

2001-07-25 Thread Renato De Giovanni
I'm working on a project based on an unusual data model. Some entities aren't represented by separate tables, they're grouped in the same table just like the following simplified model shows: CREATE TABLE class ( id CHAR(8) NOT NULL, name VARCHAR(30) NOT NULL, PRIMARY K

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

2001-07-25 Thread Henshall, Stuart - WCP
Hello, Here's a quick function to count the total number of rows in none system tables: DROP FUNCTION cnt_rows(); CREATE FUNCTION cnt_rows() RETURNS int4 AS ' DECLARE r RECORD; rb RECORD; tot int4; sqlstr text; BEGIN tot:=0; FOR r IN select *

Re: [SQL] Determining if two subnets intersect

2001-07-25 Thread Florian Weimer
Tom Lane <[EMAIL PROTECTED]> writes: > Florian Weimer <[EMAIL PROTECTED]> writes: > > 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)? > > Ma