Re: [SQL] Select default values

2008-07-26 Thread Giorgio Valoti
On 24/lug/08, at 23:15, Richard Broersma wrote: On Thu, Jul 24, 2008 at 12:35 PM, Giorgio Valoti <[EMAIL PROTECTED]> wrote: Um - there is no default value for a function. Without this "feature" you have to overload the function arguments. You could pass a casted null to the function. T

Re: [SQL] Select default values

2008-07-24 Thread Richard Broersma
On Thu, Jul 24, 2008 at 12:35 PM, Giorgio Valoti <[EMAIL PROTECTED]> wrote: >> Um - there is no default value for a function. > > Without this "feature" you have to overload > the function arguments. You could pass a casted null to the function. The would eliminate function overloading. Then in

Re: [SQL] Select default values

2008-07-24 Thread Giorgio Valoti
On 24/lug/08, at 12:42, Richard Huxton wrote: Giorgio Valoti wrote: postgres=# insert into f(a,b) values(default, default) returning *; It seems that you can’t use the same syntax with function calls: select function(default,default); gives a syntax error. Is it expected? Um - there is no d

Re: [SQL] Select default values

2008-07-24 Thread Richard Huxton
Giorgio Valoti wrote: postgres=# insert into f(a,b) values(default, default) returning *; It seems that you can’t use the same syntax with function calls: select function(default,default); gives a syntax error. Is it expected? Um - there is no default value for a function. -- Richard Hux

Re: [SQL] Select default values

2008-07-24 Thread Giorgio Valoti
On 23/lug/08, at 11:28, Pavel Stehule wrote: Hello 2008/7/23 Maximilian Tyrtania <[EMAIL PROTECTED]>: Hi there, just a quickie: Is there a way to select all default values of a given table? Something like "Select Default values from sometable" ? Unfortunately this syntax doesn't seem to be

Re: [SQL] Select default values

2008-07-23 Thread Scott Marlowe
On Wed, Jul 23, 2008 at 3:57 AM, Maximilian Tyrtania <[EMAIL PROTECTED]> wrote: > Hi, > >> am Wed, dem 23.07.2008, um 10:32:58 +0200 mailte Maximilian Tyrtania >> folgendes: >>> Hi there, just a quickie: Is there a way to select all default values of a >>> given table? Something like "Select Defau

Re: [SQL] Select default values

2008-07-23 Thread Maximilian Tyrtania
Pavel, fantastic, that's exactly what I wanted, thank you very much! Maximilian Tyrtania > Von: Pavel Stehule <[EMAIL PROTECTED]> >> Okay, here is one final (i hope) obstacle. My db has >200 tables and I'd >> love to be able to write some function that would just take a tablename and >> return

Re: [SQL] Select default values

2008-07-23 Thread Pavel Stehule
2008/7/23 Maximilian Tyrtania <[EMAIL PROTECTED]>: > Hi, > >> begin >> insert ... >> rollback; >> >> it's not best solution, but it just works. > > Ah, yes, of course, haven't thought of that. > > Okay, here is one final (i hope) obstacle. My db has >200 tables and I'd > love to be able to write

Re: [SQL] Select default values

2008-07-23 Thread Karsten Hilbert
On Wed, Jul 23, 2008 at 12:35:08PM +0200, Maximilian Tyrtania wrote: > With your way (insert into f(a,b) values(default, default) returning *) i > need to know everything about the given table. > > Hmm. Any ideas? Do look at the information schema. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.n

Re: [SQL] Select default values

2008-07-23 Thread Maximilian Tyrtania
Hi, > begin > insert ... > rollback; > > it's not best solution, but it just works. Ah, yes, of course, haven't thought of that. Okay, here is one final (i hope) obstacle. My db has >200 tables and I'd love to be able to write some function that would just take a tablename and return the de

Re: [SQL] Select default values

2008-07-23 Thread Pavel Stehule
2008/7/23 Maximilian Tyrtania <[EMAIL PROTECTED]>: > Hi again, > >>> Hi there, just a quickie: Is there a way to select all default values of a >>> given table? Something like "Select Default values from sometable" ? > >> it's not possible directly, you can find expressions used as default >> in sy

Re: [SQL] Select default values

2008-07-23 Thread Maximilian Tyrtania
Hi, > am Wed, dem 23.07.2008, um 10:32:58 +0200 mailte Maximilian Tyrtania > folgendes: >> Hi there, just a quickie: Is there a way to select all default values of a >> given table? Something like "Select Default values from sometable" ? > > test=# create table t_with_defaults( s1 int default 1

Re: [SQL] Select default values

2008-07-23 Thread Maximilian Tyrtania
Hi again, >> Hi there, just a quickie: Is there a way to select all default values of a >> given table? Something like "Select Default values from sometable" ? > it's not possible directly, you can find expressions used as default > in system tables or > postgres=# create table f(a integer defaul

Re: [SQL] Select default values

2008-07-23 Thread Pavel Stehule
Hello 2008/7/23 Maximilian Tyrtania <[EMAIL PROTECTED]>: > Hi there, just a quickie: Is there a way to select all default values of a > given table? Something like "Select Default values from sometable" ? > Unfortunately this syntax doesn't seem to be supported. I know i can select > the default v

Re: [SQL] Select default values

2008-07-23 Thread A. Kretschmer
am Wed, dem 23.07.2008, um 10:32:58 +0200 mailte Maximilian Tyrtania folgendes: > Hi there, just a quickie: Is there a way to select all default values of a > given table? Something like "Select Default values from sometable" ? > Unfortunately this syntax doesn't seem to be supported. I know i can

[SQL] Select default values

2008-07-23 Thread Maximilian Tyrtania
Hi there, just a quickie: Is there a way to select all default values of a given table? Something like "Select Default values from sometable" ? Unfortunately this syntax doesn't seem to be supported. I know i can select the default values for each column, but being able to select them in one go wou