Can't you do something like
select age from ages order by age limit 1 offset (select count(*) from ages)/2;
except you can't nest the select so you'll have to use a variable to hold it...
Make sure it does the right thing when there is an odd number of rows.
I don't understand why you want th
Patrik Kudo wrote:
> [...]
>
> Is it at all possible to create an index on lower(name), and in that case,
> what type of index and using what syntax?
You'll want to look at section 7.5 "Functional Indices" in the 7.1.3 'User's Guide'.
Allan.
---(end of broadcast)---
Tom Lane wrote:
> [...]Because the IEEE float math standard says so. Round-to-nearest-even
> is considered good practice.
I learn something new every day. :-)
While it is true that IEEE 754 defaults to "round-to-nearest", which means rounding
midway points to even, it is slightly confusing t
Pat M wrote:
> Can I use a function to execute a query and return a row or set of rows?
No. Consider using temporary tables if you must do this.
> If
> so, can you point me to some examples or perhaps give me an example of a
> function that would do roughly the same thing as:
>
> select * from
Try using temporary tables. Functions can't return tables and, it would seem, SETOFs.
srinivas wrote:
> i have tried retrieving multiple values using setof function but i
> couldnt solve it.when i am trying using setof iam getting this as
> output.
>
>
> 1 CREATE FUNCTION hobbies (varchar
Josh,
Thanks for your explanation. I'd like to get hold of a copy of SQL99/PKG001 to see
what they have actually defined.
I think the INTERVAL type sux :-) Long rant follows - consider hitting the delete
button now.
In this area, there are a number of different concepts that it would make
1. I'm assuming that psql works fine? psql -h 127.0.0.1 mpact?
1b. Have you checked the port?? You ARE running postmaster with the '-i' option,
aren't you?
The recommended solutions are typically to use the DBI and DBD modules. Try man
DBD::Pg.
Alternatively: have you tried the setdbLogin
Josh Berkus wrote:
> Or, to put it another way, 95% of the time users just want to do simple
> things. Like we want to know how many weeks an employee has been with
> us for: '2 years 3 months'::INTERVAL / '1 week'::INTERVAL (and we
> don't care about the fractional week left over).
> Thus we
Josh Berkus wrote:
> This is a multi-part MIME message
>
> --_===97089davinci.ethosmedia.com===_
> Content-Type: text/plain; charset="ISO-8859-1"
> Content-Transfer-Encoding: 8bit
>
> Tom, Stephan,
>
> I'm writing up the date/time FAQ, and I came across some operator
> behavior that confuses
have a dash, so I guess I won't hold my
breath....
Now I'm sad.
Allan.
Allan Engelhardt wrote:
> Stephan Szabo wrote:
>
> > On Sun, 5 Aug 2001, Allan Engelhardt wrote:
>
> [see new example below]
>
> > Not that this is related to what you asked about pr
Stephan Szabo wrote:
> On Sun, 5 Aug 2001, Allan Engelhardt wrote:
[see new example below]
> Not that this is related to what you asked about precisely (I saw the
> response you made), but the query above also doesn't do what you think
> it does right now. It currently mak
I obviously haven't had enough coffee yet... :-) The following script works as
expected.
drop database test;
create database test;
\c test
create table foo (id integer primary key);
create table bar () inherits (foo);
create unique index bar_id_idx ON bar(id);
create table baz (bar integer,
I would like to create a FOREIGN KEY constraint to an inherited column, like:
test=# CREATE TABLE foo(id INTEGER PRIMARY KEY);
test=# CREATE TABLE bar() INHERITS (foo);
test=# CREATE TABLE baz (bar INTEGER, CONSTRAINT fk_bar FOREIGN KEY (bar)
REFERENCES bar(id));
ERROR: UNIQUE c
I would dearly love to do
CREATE GROUP foo WITH USER CURRENT_USER;
in a script to psql(1), but this does not appear to be supported by the parser.
Two questions:
1. Does anybody have a good work-around for this?
2. Is there a document somewhere that says where functions are allowed in SQL
14 matches
Mail list logo