[SQL] delete on cascade

2006-10-23 Thread Luca Ferrari
Hi all, I guess this is an already asked question, but I didn't found an answer, so apologize me. Imagine I've got two tables: skill(id,description) // primary key = id family(id,description) // primary key = id and I want to associate skills to families: ass_sf(id_skill,id_family)

Re: [SQL] delete on cascade

2006-10-23 Thread Luca Ferrari
On Monday 23 October 2006 11:00 Achilleas Mantzios's cat, walking on the keyboard, wrote: not right!!! ON DELETE CASCADE is specified in FOREIGN KEY contsraints. So that would be in ass_sf table. If you find ALTER TABLE ass_sf command hard to run, then drob your ass_sf table and define it

[SQL] hiding column values for specific rows

2006-11-13 Thread Luca Ferrari
Hi, I don't know if this's possible but I'd like to hide column values for specific rows within a query. Imagine I've got a table with columns username and password: users(username,password). Now I'd like the user registered in the table to see her password, to see who is registered but not to

[SQL] sql problem with join

2006-11-15 Thread Luca Ferrari
Hi all, I've got a problem tryng to define a view with a few joins, I'll appreciate if someone could drive me in the definition of such query. I've got a table roleSkill that contains a row for each skill belonging to a defined role and with the desired competence level for such skill in such

Re: [SQL] sql problem with join

2006-11-15 Thread Luca Ferrari
On Wednesday 15 November 2006 16:20 your cat, walking on the keyboard, wrote: May be you could show the results you are getting and then make up some results that you would really like to get. I am not entirely clear what you are trying to achieve. Lastly I found the solution, for the

Re: [SQL] Advice on key design

2013-07-24 Thread Luca Ferrari
On Wed, Jul 24, 2013 at 10:38 AM, Bèrto ëd Sèra berto.d.s...@gmail.com wrote: What would be the rationale behind the serial number? The serial key, also named surrogate key is there for management purposes. Imagine one day you find out your database design is wrong and what was unique the day

Re: [SQL] Advice on key design

2013-07-24 Thread Luca Ferrari
On Wed, Jul 24, 2013 at 11:47 AM, Bèrto ëd Sèra berto.d.s...@gmail.com wrote: Hi, It looks heavy, performance-wise. If this is not OLTP intensive you can probably survive, but I'd still really be interested to know ow you can end up having non unique records on a Cartesian product, where the

Re: [SQL] monthly statistics

2013-07-24 Thread Luca Ferrari
On Mon, Jul 8, 2013 at 2:18 PM, Andreas maps...@gmx.net wrote: How could I combine those 2 queries so that the date in query 1 would be replaced dynamically with the result of the series? Surely I'm missing something, but maybe this is something to work on: WITH RECURSIVE months(number) AS

Re: [SQL] CTAGS for PL/pgSQL ?

2013-08-29 Thread Luca Ferrari
On Wed, Aug 28, 2013 at 5:08 PM, Charles Sheridan cesh...@swbell.net wrote: Does anyone know if there are any CTAGS extensions or variants that support PL/pgSQL ? I use exuberant-ctags which does not support it, and a web search does not return anything promising. As far as I know, the quick

Re: [SQL] CTAGS for PL/pgSQL ?

2013-08-29 Thread Luca Ferrari
On Thu, Aug 29, 2013 at 3:33 PM, Bruce Momjian br...@momjian.us wrote: Uh, I think Vim can use etags, no? Isn't etags Exuberant Ctags? The Exuberant Ctags's FAQ mentions Vim: I was referring to the etags shipped with emacs, that even if does not support (explicitly) sql seems to work for a

Re: [SQL] detect initiator of update/delete action

2013-09-20 Thread Luca Ferrari
On Fri, Sep 20, 2013 at 9:52 AM, ssylla stefansy...@gmx.de wrote: There are two cases: 1. if the deletion was executed through a user action, both the update and insert statement of the 'table1_del' function should be executed 2. if the deletion was initiated through a function fired from

Re: [SQL] the value of OLD on an initial row insert

2013-09-23 Thread Luca Ferrari
On Fri, Sep 20, 2013 at 6:43 PM, James Sharrett jsharr...@tidemark.net wrote: ERROR: record old is not assigned yet SQL state: 55000 Detail: The tuple structure of a not-yet-assigned record is indeterminate. Is this what's happening? If so, how can I avoid the issue. If I get it right you