Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1etEs1-00087n-8I for pgsql-general@arkaria.postgresql.org; Tue, 06 Mar 2018 15:51:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1etEs0-00036d-1H for pgsql-general@arkaria.postgresql.org; Tue, 06 Mar 2018 15:51:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1etErz-00036S-LL for pgsql-general@lists.postgresql.org; Tue, 06 Mar 2018 15:51:15 +0000 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1etErw-0003cd-OU for pgsql-general@postgresql.org; Tue, 06 Mar 2018 15:51:15 +0000 Received: by mail-oi0-x242.google.com with SMTP id b8so15160790oib.11 for ; Tue, 06 Mar 2018 07:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgsqlrocket-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=a2w2QmgSTIcVsfA2d+9SxnpodAH8soePnnMl7Q0XExI=; b=hBFI0Cu74Puv8C3gjVfCOGUuziyHg66G5/0wNoIBJuuzdY3Q10SFLjiZXD+3bMDENd vnQmDPe1Kp0JgyZndCkIYskPV8t8WXFVqMds/BblpO84Y1wMh5u57iWT9YzOyZFkVzmt cc/DTsB4DAnWW6cOmJ8DbWbSobMz1lx7NRoukYkG0huuUfG8Y4nCwgsLHzRAuLEAOZAx tJVD4nKVlgAPHi4GuuNe/kktcOmJQwY7lde9aF4Bp0AsXO/5A+2v1IT264yTlTl24lyY ftd/8vjBlDn2tS4SjLNneDer8M7M832dlD2lXCfAPIi1OdgxM0Zd8XVDRamYjK3y1y2C RgGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=a2w2QmgSTIcVsfA2d+9SxnpodAH8soePnnMl7Q0XExI=; b=Q98ULWgyEYGTfcWeCfVfbTebJ7Bc9N0V00IhG5KFfiReuFu8INVTalw/NYTVMl0ifG P4Xaru7MMS6cus91vslmnuCaoTLXbKQTbbAT7h/XshZFfICEXOD7xLtqpQyOEXM1GFWa xQfnovYG/1HUhkEsQ8zLZJ6vC85uVFE0F8PN38prj5nbAT4cq5w6AwUNxReHhAkHtTi+ 6UhFyO6tyLSGJSUlrABlLqm6DFq/4d8IcnT0HKccmzS8NBkEMz80yyI7+MrL3iY7XmHp S6zHalAu+yl4xrQcllJdkToUK1MsZ+OwGRSAw9jlyzipBuuU+RBlKfxFsOXRv1LWLnZH FUSw== X-Gm-Message-State: AElRT7FxOCT7glGEALIdZdMqMtwNcT/H7Ip7NXGCjzVb+ilZC+K6gJuX pAEIjcOWBrVmI31PWSLu8u133BYbSiY= X-Google-Smtp-Source: AG47ELtzHZLh1JHU3xQRa/dc27axcXOYHfLpjteATzwg1qvwQ1JAlVstacw0Ikh1KfO/HnO8MLE/vA== X-Received: by 10.84.78.147 with SMTP id c19mr11242825oiy.143.1520351469554; Tue, 06 Mar 2018 07:51:09 -0800 (PST) Received: from localhost.localdomain ([65.132.155.214]) by smtp.gmail.com with ESMTPSA id x6sm7642229ota.77.2018.03.06.07.51.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 07:51:08 -0800 (PST) From: chris Subject: plpgsql function-parsing To: pgsql-general@postgresql.org Message-ID: Date: Tue, 6 Mar 2018 08:51:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I am trying to create a function that gets passed a statement as a string and then I need to change the table_name within the string by adding a "_cdc" to it, then execute the statement ex: string passed could be GRANT all ON authors TO bob. then EXECUTE GRANT all ON authors_cdc TO bob I'm looking into parsing the string but i can't find a way to parse in a way that'll work. Any ideas? Thanks, Chris