[SQL] Private functions

2010-03-13 Thread Gianvito Pio
Hi all, is there a way to write a function that can only be called by another function but not directly using SELECT function_name ( )? Thanks -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

[SQL] Check type compatibility

2010-03-06 Thread Gianvito Pio
Hi all, is there a way to check if two attribute are type compatible (for example integer and serial, integer and integer, character varying and text, etc..)? Example: IF (compatible (table1.att1, table2.att2)) THEN ... ELSE ... END IF; Thanks -- Sent via pgsql-sql mailing

[SQL] Drop all constraints

2010-03-06 Thread Gianvito Pio
Hi all, is there a way to drop all constraints of a table? I found this workaround in the manual: CREATE TABLE temp AS SELECT * FROM distributors; DROP TABLE distributors; CREATE TABLE distributors AS SELECT * FROM temp; DROP TABLE temp; Is there any other way to do it? Thanks -- Sent via

[SQL] Triggers on system tables

2010-03-03 Thread Gianvito Pio
Hi all, is there a way (also strange) to define a trigger on a system table (for example on pg_class)? I tried but I got (as expected) a permission denied message... Thanks

[SQL] Create functions using a function

2010-03-01 Thread Gianvito Pio
Hi all, is there a way to define functions and/or triggers in a function? For example, can I create a function that takes an argument and defines a function that has the name passed as argument to the first function? Something like this . CREATE FUNCTION test (name varchar) RETURNS VOID AS

[SQL] Timestamp with timezone with Default value

2009-07-18 Thread Gianvito Pio
Hi all, how can I define a column of timestamp with timezone type...with a default value? Thanks

[SQL] Table inheritance problem

2009-07-18 Thread Gianvito Pio
Hello, I have 3 tables: persons, operators and persons_position. This is a semplified examples of their structures: CREATE TABLE persons (id varchar NOT NULL, CONSTRAINT PK_Persons PRIMARY KEY(id)); CREATE TABLE operators (id varchar NOT NULL, CONSTRAINT PK_Operators PRIMARY KEY(id))

Re: [SQL] Type inheritance

2009-06-06 Thread Gianvito Pio
...@gmail.com I'm not sure how Temperature and Humidity are related as types beyond extends float. i.e. What tuple definition could alternatively have a Temp or a Humidity value? (I do understand their physical relationship :) ) Gianvito Pio wrote: Hi all, I just want to ask you if it's

Re: [SQL] Type inheritance

2009-06-06 Thread Gianvito Pio
, June 06, 2009 2:04 PM Subject: Re: [SQL] Type inheritance On 2009-06-06, Gianvito Pio pio.gianv...@gmail.com wrote: --001485f44bfe3e357c046ba8b3d6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Oh that was just an example...Let me make a real example: I have a table

[SQL] Type inheritance

2009-06-05 Thread Gianvito Pio
Hi all, I just want to ask you if it's possible to define sub types in PostgreSQL (Type inheritance). I found that table inheritance is possible...but I'd like to do it on types. Example: define a type Value and two subtypes Temperature and Humidity and then define a table that has an attribute

Re: [SQL] Type inheritance

2009-06-05 Thread Gianvito Pio
Domains just allow me to redefine base types, including some restrictions. I just want to define a my own type and then to define some new types that inherit from the first one. I hope it's clear now... 2009/6/5 Tom Lane t...@sss.pgh.pa.us Gianvito Pio pio.gianv...@gmail.com writes: I just

[SQL] Methods declaration

2009-03-17 Thread Gianvito Pio
Hello, I've just started working with ordbms. I'm searching for differences between postgresql and oracle... Btw, I've found it's possible to declare a method for a specific type in oracle...so if I create a type MyType, I can associate it also a method MyMethodusing the costructors: CREATE