Re: [SQL] on insert rule with default value

2012-02-22 Thread Ron Peterson
2012-02-21_15:51:30-0500 Ron Peterson rpete...@mtholyoke.edu: My rule below does not insert the the same uuid value into the test_log table as is created in the test table when I insert a new value. I know I've worked through this before, but I'm not remembering why this is. What's a right

[SQL] on insert rule with default value

2012-02-21 Thread Ron Peterson
, attime ) values ( new.anid, new.value, 'insert', now() ) ); -- Ron Peterson Network Systems Administrator Mount Holyoke College http://www.mtholyoke.edu/~rpeterso -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org

[SQL] create temp table in rule

2006-04-18 Thread Ron Peterson
SELECT * FROM id_temp; ); As you can see, I'm trying to create a simple 'insert or update' rule. -- Ron Peterson Network Systems Manager Mount Holyoke College http://www.mtholyoke.edu/~rpeterso ---(end of broadcast)--- TIP 1: if posting

Re: [SQL] simulating row ownership

2005-01-11 Thread Ron Peterson
INTO test ( aname ) VALUES ( 'yourusername' ); CREATE RULE lock_test_user_update AS ON UPDATE TO test WHERE old.aname = CURRENT_USER DO INSTEAD nothing; CREATE RULE lock_test_user_delete AS ON DELETE TO test WHERE old.aname = CURRENT_USER DO INSTEAD nothing; -- Ron Peterson Network Systems Manager

Re: [SQL] simulating row ownership

2005-01-11 Thread Ron Peterson
, these rules should say !=, of course... -- Ron Peterson Network Systems Manager Mount Holyoke College http://www.mtholyoke.edu/~rpeterso ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send

Re: [SQL] Question about insert/update RULEs.

2005-01-10 Thread Ron Peterson
the scope of currval() is. The value of currval will be predictable within the current session. I.E., if another session increments the sequence, the value returned by currval in the current session won't change. Best. -- Ron Peterson Network Systems Manager Mount Holyoke College http

Re: [SQL] insert rule doesn't see id field

2003-01-13 Thread Ron Peterson
On Tue, Jan 07, 2003 at 11:01:08AM -0500, Tom Lane wrote: Ron Peterson [EMAIL PROTECTED] writes: CREATE RULE person_insert AS ON INSERT TO person DO INSERT INTO person_log ( name_last, name_first, mod_type, person_id ) VALUES ( new.name_last, new.name_first, 'I', new.id

Re: [SQL] insert rule doesn't see id field

2003-01-10 Thread Ron Peterson
On Thu, Jan 09, 2003 at 11:53:42PM -0500, Tom Lane wrote: Ron Peterson [EMAIL PROTECTED] writes: On Thu, Jan 09, 2003 at 04:50:56PM -0500, Ron Peterson wrote: colindices = (int *) malloc (ncols * sizeof (int)); Of course we should verify that malloc succeeded... Actually, the correct

Re: [SQL] noupcol code cleanup

2003-01-10 Thread Ron Peterson
PointerGetDatum (newnewtuple); } -- Ron Peterson -o) Network Systems Manager /\\ Mount Holyoke College_\_v http://www.mtholyoke.edu/~rpeterso ---(end of broadcast)--- TIP 5: Have you checked

Re: [SQL] insert rule doesn't see id field

2003-01-09 Thread Ron Peterson
== SPI_ERROR_NOATTRIBUTE) { elog (ERROR, noupcols: bad attribute value passed to SPI_modifytuple\n); return PointerGetDatum (NULL); } return PointerGetDatum (newnewtuple); } -- Ron Peterson -o) Network Systems Manager /\\ Mount Holyoke

Re: [SQL] insert rule doesn't see id field

2003-01-09 Thread Ron Peterson
On Wed, Jan 08, 2003 at 01:13:03PM -0500, Ron Peterson wrote: On Tue, Jan 07, 2003 at 11:01:08AM -0500, Tom Lane wrote: I thought that the idea behind noup was to protect single columns from update. However, when I apply the noup trigger as above, I can't update /any/ column

Re: [SQL] insert rule doesn't see id field

2003-01-09 Thread Ron Peterson
On Thu, Jan 09, 2003 at 04:50:56PM -0500, Ron Peterson wrote: colindices = (int *) malloc (ncols * sizeof (int)); Of course we should verify that malloc succeeded... if (colindices == NULL) { elog (ERROR, noupcol: malloc failed\n); SPI_finish(); return

Re: [SQL] insert rule doesn't see id field

2003-01-08 Thread Ron Peterson
be a pain. So that's the problem I'd like to prevent, for which I think this function would be useful. So I'll hack at it and see what I come up with. Might not happen immediately, though.. -- Ron Peterson -o) Network Systems Manager /\\ Mount Holyoke

[SQL] insert rule doesn't see id field

2003-01-07 Thread Ron Peterson
=# select * from person; name_last | name_first | id ---++ Peterson | Ronald | 1 Humbert | Humbert| 2 (2 rows) directory=# update person set name_first='Ron' where name_first='Ronald'; NOTICE: id: update not allowed UPDATE 0 -- Ron Peterson

Re: [SQL] insert rule doesn't see id field

2003-01-07 Thread Ron Peterson
BTW, PostgreSQL 7.2.1-2woody2 on Debian. -- Ron Peterson -o) Network Systems Manager /\\ Mount Holyoke College_\_v http://www.mtholyoke.edu/~rpeterso ---(end of broadcast)--- TIP 5

Re: [SQL] graphical interface - admin

2002-06-27 Thread Ron Peterson
On Thu, Jun 27, 2002 at 07:50:09PM +0800, q u a d r a wrote: What's the best open source GUI for DB administration? (postgres) Emacs. ;) -- Ron Peterson -o) 87 Taylor Street /\\ Granby, MA 01033 _\_v https://www.yellowbank.com

[SQL] finding foreign keys

2001-01-23 Thread Ron Peterson
Can anyone suggest a more elegant way of finding foreign keys than parsing the tgargs value returned by this query? I'd really rather do pure SQL, sans string parsing, if possible. -- Find tables and foreign keys CREATE

[SQL] system catalog info

2000-12-29 Thread Ron Peterson
The HTML programming documentation (e.g. http://www.postgresql.org/devel-corner/docs/programmer/pg-system-catalogs.htm) indicates that more extensive information about the system catalogs can be found in the "Reference Manual". Where can this reference manual be found? Or where can more

Re: [SQL] Compiling C Functions

2000-12-29 Thread Ron Peterson
Tulio Oliveira wrote: I appreciate any "C" Function complete samples, including de command line for the compiler. I've attached a generic GNU make snippet for compiling .so files. Adjust to suite your tastes. Like my math textbooks used to say "writing the C code is trivial, and is left

Re: [SQL] Tree structure table normalization problem (do I need a trigger?)

2000-12-29 Thread Ron Peterson
Frank Joerdens wrote: In a recent thread (How to represent a tree-structure in a relational database) I asked how to do a tree structure in SQL, and got lots of suggestions (thanks!), of which I chose the one below: create table Category ( CategoryID int4 not null primary key,

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-29 Thread Ron Peterson
Ron Peterson wrote: CREATE TABLE category_edge ( parent INTEGER NOT NULL REFERENCES category_node(id), child INTEGER NOT NULL REFERENCES category_node(id) ); Just for the sake of anal-retentive

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-29 Thread Ron Peterson
Stuart Statman wrote: I would suggest, instead, to create a table that represents your hierarchy without adding columns. For example : create table Category ( CategoryID int4 not null primary key, ParentCategoryID int4 not null REFERENCES Category (CategoryID), CategoryName