Re: passing schema name and table name as parameter functions in postgresql 9.2 - Mailing list pgsql-general

From anushasrivastava03
Subject Re: passing schema name and table name as parameter functions in postgresql 9.2
Date
Msg-id 1370588315101-5758259.post@n5.nabble.com
Whole thread Raw
In response to Re: passing schema name and table name as parameter functions in postgresql 9.2  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: passing schema name and table name as parameter functions in postgresql 9.2
List pgsql-general
hi my requirement is to create a table as a result of sub-query and the table
and schema name should be passed as parameters of a function


i also tried like this;


CREATE OR REPLACE FUNCTION secc_master.chkschema(schemaname text, tableis
text)
  RETURNS void AS
$BODY$
DECLARE
   ione boolean;

BEGIN



EXECUTE 'create table '||quote_literal($1)||'.'||quote_literal($2)||' as
select * from master.master_state where state_code not in ( select
distinct(statecode)from master.population_2 )';



end;
$BODY$
  LANGUAGE plpgsql



 select * from secc_master.chkschema('secc_master', 'chktbl')

ERROR:  syntax error at or near "'secc_master'"
LINE 1: create table 'secc_master'.'chktbl' as  select * from master...





--
View this message in context:
http://postgresql.1045698.n5.nabble.com/passing-schema-name-and-table-name-as-parameter-functions-in-postgresql-9-2-tp5758130p5758259.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: c k
Date:
Subject: compiling postgresql 9.2.4 on fedora 17 64 bit takes very long time
Next
From: anushasrivastava03
Date:
Subject: Re: passing schema name and table name as parameter functions in postgresql 9.2