>
> Christoph Haller wrote:
> > Hi pgsql-sql list,
> > I did some testing around tables using a column
> > timestamp with time zone not null default now().
> > I have noticed a valuable feature:
> > As long as being inside a transaction initiated by
> > begin;
> > the return value of the now() fun
> Hi everybody,
> I was playing with psql and accidently deleted a couple of records from
> my database. I am wondering if there is any way to restore them. I know
> that in Oracle you can do 'rollback work' from SQLPlus interface and it
> would rollback all the updates done to the database.
That
>
> I want lock full tables,how to write SQL command?
> thanks
>
BEGIN ;
LOCK TABLE ;
/* done, locked until "commit;" */
Refer to the SQL-LOCK-command for further
information.
Regards, Christoph
---(end of broadcast)---
TIP 5: Have you ch
>
> Is there a way of testing for membership in an int2vector-field? For
> example:
> select column, "prim.key" from ... where pg_attribute.attnum in
> pg_index.indkey
> ??
>
I think so. Refer to the array section of the documentation.
Extract:
To search for a value in an array, you must check
Hi Esteban,
Your problem looks familiar to me,
and it seems you did not follow my advice.
Anyway, here is a C sample program which works.
It has nothing to do with wrong types, but with a
missing connection, but see for yourself.
/*
/opt/pgsql/bin/ecpg -o sampleprog01.c sampleprog01.sql
th
>
> Hi All,
> Can we create a query to find different values based on different criteria =
> from a table using case structure. For example
>
Select Into :DBComment
Case When localComment Is Null Then Comment
When localComment = '123' Then 'Numeric Comment'
First of all, thanks to Philip Hallstrom for the quick reply.
Consider the following tables
CREATE TABLE advncd_onfvalue
(timepoint DATETIMENOT NULL,
midINTEGER NOT NULL,/* measurement id */
lidINTEG
This may look familiar to you - it was on the list last month.
Consider the following table
create table partitur
(userid text, val integer, ts timestamp DEFAULT NOW() );
Do some inserts
insert into partitur values('Bart', 1440);
insert into partitur values('Lisa', 1024);
insert into partitur
Have you tried already
SELECT DISTINCT FROM ;
If you receive an error message like
Unable to identify an ordering operator ...
Refer to 'Server Programming' section Extending SQL: Operators
to learn about creating your own operators for array comparison
Or search the mailing-list for simil
I'm having some experience with C embedded SQL
and what I can see at first sight is
1) DECLARE CURSOR statement - missing colon:
EXEC SQL DECLARE C77 CURSOR FOR select datname from pg_user,pg_database
where usename= :user and datdba= :usesysid;
2) before OPEN you have to declare and set the wh
>
> Consider the following table:
>
> A B C D select?
> ---
> 1 FOO A1 100 n
> 1 BAR Z2 100 n
> 2 FOO A1 101 y
> 2 BAR Z2 101 y
> 3 FOO A1 102 y
> 4 BAR
>
> Consider the following table:
>
> A B C D select?
> ---
> 1 FOO A1 100 n
> 1 BAR Z2 100 n
> 2 FOO A1 101 y
> 2 BAR Z2 101 y
> 3 FOO A1 102 y
> 4 BAR
I've tried (column indexdef is of type text)
select indexdef from pg_indexes where indexdef like '%pg_proc%' ;
select indexdef from pg_indexes where position('pg_proc' in indexdef) > 0 ;
select upper(indexdef) from pg_indexes where position('pg_proc' in indexdef) > 0 ;
and all three worked as
>
> I would like to compare the number of rows
> of one table and of another and use it in
> a query like this:
> SELECT * FROM
> WHERE "number of rows of table "
> EQUALS
>"number of rows of table "
> i.e. I only want get a query result if th
What do you mean by
"the latest val for each userid"
I cannot understand how a value of type integer
can have a attribute like "latest".
Sorry, but I need at least a bit more information.
Regards, Christoph
>
> On Thu, 20 Sep 2001, Haller Christoph wrote:
>
Try
create NEWtable (userid text, val integer, ts timestamp);
insert into NEWtable
select userid, val, max(ts) from table group by userid, val;
Regards, Christoph
>
> Hi,
>
> I have a table which basically looks like this:
>
> create table (userid text, val integer, ts timestamp);
>
> Thi
My understanding is, if you have system calls from within
postgres, the child processes invoked are run in the
postgres user's environment.
So, login as user postgres and have a look what aliases
are set. My idea is, because postgres is not a human user,
these aliases are not set. I think, if
I'm working on a HP-UX system, so some of the
following has to be adapted, but in principle
it's the same on every system and it works.
First piece of code is a standalone program,
which you should always write and test before
you start creating C functions inside PostgreSQL.
Second piece is
Did you use the compiler option for generating
position independent code (PIC) for use in building
shared libraries.
Did you use the linker option for creating
a shared library - I think you did, the file
suffix .so looks that way.
I did it several times successfully using commands
like
CREA
As long as there are no nulls allowed in column 'dst' the
select src,dst,count(dst) from ...
should retrieve the same result.
Try it. It should run faster anyway.
Maybe there are other ways to word your query, but without
more knowledge about your table structure and intentions
I can't tell
Within psql you can do commands like
\d
to learn rudimentary information about
a table.
Try this to learn more sophisticated information
select u.usename, t.typname, a.attname, a.atttypid, a.attlen, a.attnotnull, a.attnum
from pg_user u, pg_type t, pg_attribute a
where u.usesysid = t.typo
Am I right in assuming you were asking for
something like
SELECT Rownumbering(), ... FROM ORDER BY ;
and expecting a result like
1| ...
2| ...
3| ...
...
where Rownumbering() is a PostgreSQL function
If this is what you wanted, this is something
I want for a long time too.
Maybe we
[SQL] ERROR: Cannot insert a duplicate key into a unique index
I'm working on a C code application using loads of
insert commands.
It is essential to distinguish between an error
coming from a misformed command or other fatal
reasons and a duplicate key.
In either case, the PQresultStatus()
I tried to create a view as follows
create view sesql_userindexes as
SELECT c.relname AS TBL_NAME, i.relname AS IDX_NAME, x.indisunique AS UNIQUE_FLAG, 1+
(CASE WHEN x.indkey[1]=0 THEN 0 ELSE 1 END)+(CASE WHEN x.indkey[2]=0 THEN 0 ELSE 1
END)+
(CASE WHEN x.indkey[3]=0 THEN 0 ELSE 1 END)+(CASE
My understanding is you did it the best way.
Alternatively, you may word your query as
SELECT i.cname FROM fc_client_info i
WHERE EXISTS ( SELECT * FROM fc_communication c
WHERE c.acode = i.acode
AND c.contactdate = '09/06/2001' )
ORDER BY lower(i.cname);
instead
25 matches
Mail list logo