Обсуждение: Postgre cannot delete from a table

Поиск
Список
Период
Сортировка

Postgre cannot delete from a table

От
developer_student
Дата:
We were given a database once began in the company. Since it is used as a
log, we want to delete its rows frequently.

Then, when I write this statement from pgAdmin III Query:
delete from Lacaja.public.messagetbl;

I get the next message:
ERROR:  cross-database references are not implemented:
"Lacaja.public.messagetbl"

Am I trying to accede multiple databases? I don't understand. I want only
delete from a table of a database.

I show the messagetbl table format:


- Table: messagetbl

-- DROP TABLE messagetbl;

CREATE TABLE messagetbl
(
  msgid int8 NOT NULL,
  originsourceid int4 NOT NULL,
  routedbid int4,
  userfieldsid int8,
  msgtypeid int4 NOT NULL,
  oldmsgid varchar(255),
  regdate timestamp NOT NULL,
  msgblob bytea NOT NULL,
  msgbodyid int8 NOT NULL,
  destinationdbid int4 NOT NULL,
  sortindex int4 NOT NULL,
  state char(1) NOT NULL,
  deaddate timestamp,
  CONSTRAINT messagetbl_pkey PRIMARY KEY (msgid)
)
WITHOUT OIDS;
ALTER TABLE messagetbl OWNER TO administrador;


-- Index: messagetbl_deaddate

-- DROP INDEX messagetbl_deaddate;

CREATE INDEX messagetbl_deaddate
  ON messagetbl
  USING btree
  (deaddate);

-- Index: messagetbl_msgbodyid

-- DROP INDEX messagetbl_msgbodyid;

CREATE INDEX messagetbl_msgbodyid
  ON messagetbl
  USING btree
  (msgbodyid);

-- Index: messagetbl_regdate

-- DROP INDEX messagetbl_regdate;

CREATE INDEX messagetbl_regdate
  ON messagetbl
  USING btree
  (regdate);

-- Index: messagetbl_state_destinationdbid

-- DROP INDEX messagetbl_state_destinationdbid;

CREATE INDEX messagetbl_state_destinationdbid
  ON messagetbl
  USING btree
  (state, destinationdbid);


How can I delete rows from this table?

Anyonce can help me, please?
Thank you in advance.

--
View this message in context: http://www.nabble.com/Postgre-cannot-delete-from-a-table-tf2345371.html#a6528711
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


Re: Postgre cannot delete from a table

От
Tom Lane
Дата:
developer_student <juamagb1@gmail.com> writes:
> Then, when I write this statement from pgAdmin III Query:
> delete from Lacaja.public.messagetbl;

> I get the next message:
> ERROR:  cross-database references are not implemented:
> "Lacaja.public.messagetbl"

> Am I trying to accede multiple databases?

The code thinks so.  Are you actually doing this in a database named
Lacaja, or something else?  I'm wondering in particular about
the capitalization of the name ("lacaja" and "Lacaja" are different).

You could avoid the whole question by not writing the database name,
which you don't need anyway.

            regards, tom lane

Re: Postgre cannot delete from a table

От
developer_student
Дата:
Yes, you're right: I changed the database name because of privacy reasons.

Tha database server understands the default database is 'postgres', so when
I execute the query without the database name, it doesn't find the table
messagetbl because it's finding in 'postgres' database. How can I tell the
server the default database is 'Lacaja' ?

anyone can help me, please?
Thank you.
--
View this message in context: http://www.nabble.com/Postgre-cannot-delete-from-a-table-tf2345371.html#a6532385
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.