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's
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 each
I want lock full tables,how to write SQL command?
thanks
BEGIN ;
LOCK TABLE tablename ;
/* done, locked until commit; */
Refer to the SQL-LOCK-command for further
information.
Regards, Christoph
---(end of broadcast)---
TIP 5: Have
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'
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
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 */
lid
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
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 Z2 99
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 Z2 99
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 the tables
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,
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);
This table
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
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
Within psql you can do commands like
\d tablename
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
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
Am I right in assuming you were asking for
something like
SELECT Rownumbering(), ... FROM Table ORDER BY Column ;
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
[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
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);
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
21 matches
Mail list logo